diff --git a/ape/loader.c b/ape/loader.c index 67b96f9a3b9..9ede47ae678 100644 --- a/ape/loader.c +++ b/ape/loader.c @@ -947,6 +947,11 @@ EXTERN_C __attribute__((__noreturn__)) void ApeLoader(long di, long *sp, os = OPENBSD; } + /* xnu passes auxv as an array of strings */ + if (os == XNU) { + *auxv = 0; + } + /* detect netbsd and find end of words */ pagesz = 0; for (ap = auxv; ap[0]; ap += 2) { diff --git a/ape/start.S b/ape/start.S index 907baabe11f..ec558ec3c79 100644 --- a/ape/start.S +++ b/ape/start.S @@ -23,6 +23,7 @@ #ifdef __aarch64__ _start: mov x1,sp + and sp,x1,#-16 mov x29,0 bl ApeLoader .endfn _start,globl @@ -33,6 +34,7 @@ XnuEntrypoint: mov $_HOSTXNU,%dl // xnu's not unix! ElfEntrypoint: mov %rsp,%rsi // save real stack + andq $-16,%rsp // force SSE alignment call ApeLoader .endfn ElfEntrypoint,globl .endfn XnuEntrypoint,globl