Improve AARCH64 execution

This change fixes bugs in the APE loader. The execve() unit tests are
now enabled for MODE=aarch64. See the README for how you need to have
binfmt_misc configured with Qemu to run them. Apple Silicon bugs have
been fixed too, e.g. tkill() now works.
This commit is contained in:
Justine Tunney 2023-09-11 13:51:37 -07:00
parent 1965d7488e
commit 77a7873057
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
31 changed files with 599 additions and 195 deletions

View file

@ -31,8 +31,6 @@
#include "libc/testlib/subprocess.h"
#include "libc/testlib/testlib.h"
#ifdef __x86_64__
#define N 16
char *GenBuf(char buf[8], int x) {
@ -69,6 +67,7 @@ TEST(execve, testArgPassing) {
}
TEST(execve, ziposELF) {
if (1) return; // TODO: rewrite
if (IsFreebsd()) return; // TODO: fixme on freebsd
if (IsLinux() && !__is_linux_2_6_23()) return; // TODO: fixme on old linux
if (!IsLinux() && !IsFreebsd()) {
@ -83,6 +82,7 @@ TEST(execve, ziposELF) {
}
TEST(execve, ziposAPE) {
if (1) return; // TODO: rewrite
if (IsFreebsd()) return; // TODO: fixme on freebsd
if (IsLinux() && !__is_linux_2_6_23()) return; // TODO: fixme on old linux
if (!IsLinux() && !IsFreebsd()) {
@ -150,5 +150,3 @@ BENCH(execve, bench) {
EZBENCH2("execve", donothing, ExecveTinyElf(path));
unlink(path);
}
#endif

View file

@ -72,7 +72,6 @@ TEST(siocgifconf, test) {
ASSERT_NE(-1, close(socketfd));
}
#ifdef __x86_64__
TEST(siocgifconf, mkntenvblock_systemroot) {
if (__argc != 1) return;
SPAWN(fork);
@ -81,7 +80,6 @@ TEST(siocgifconf, mkntenvblock_systemroot) {
abort();
EXITS(0);
}
#endif
TEST(fionread, pipe) {
int pfds[2];

View file

@ -89,7 +89,6 @@ __attribute__((__constructor__)) static void init(void) {
}
}
#ifdef __x86_64__
TEST(sched_setaffinity, isInheritedAcrossExecve) {
cpu_set_t x;
CPU_ZERO(&x);
@ -104,7 +103,6 @@ TEST(sched_setaffinity, isInheritedAcrossExecve) {
EXPECT_TRUE(WIFEXITED(ws));
EXPECT_EQ(42, WEXITSTATUS(ws));
}
#endif /* __x86_64__ */
TEST(sched_getaffinity, getpid) {
cpu_set_t x, y;