WIP: add _auxv retrieval for arm64
diff --git a/tools/include/nolibc/arch-aarch64.h b/tools/include/nolibc/arch-aarch64.h
index 96e0521..d1be8c5 100644
--- a/tools/include/nolibc/arch-aarch64.h
+++ b/tools/include/nolibc/arch-aarch64.h
@@ -182,6 +182,7 @@ struct sys_stat_struct {
 })
 
 char **environ __attribute__((weak));
+const void *_auxv __attribute__((weak));
 
 /* startup code */
 __asm__ (".section .text\n"
@@ -194,6 +195,12 @@ __asm__ (".section .text\n"
     "add x2, x2, x1\n"            //           + argv
     "adrp x3, environ\n"          // x3 = &environ (high bits)
     "str x2, [x3, #:lo12:environ]\n" // store envp into environ
+    "mov x4, x2\n"                // search for auxv (follows NULL after last env)
+    "0:\n"
+    "ldr x5, [x4], 8\n"           // x5 = *x4; x4 += 8
+    "cbnz x5, 0b\n"               // and stop at NULL after last env
+    "adrp x3, _auxv\n"            // x3 = &_auxv (high bits)
+    "str x4, [x3, #:lo12:_auxv]\n" // store x4 into _auxv
     "and sp, x1, -16\n"           // sp must be 16-byte aligned in the callee
     "bl main\n"                   // main() returns the status code, we'll exit with it.
     "mov x8, 93\n"                // NR_exit == 93