From 3e14288eaaf62124d090b5225665632e1fe5d47c Mon Sep 17 00:00:00 2001 From: linted Date: Sat, 16 Jul 2022 16:23:45 -0400 Subject: Added support for creation of Static Position-Independent Executables (PIE) on aarch64 Updated config to allow compilation of rcrt1.o for aarch64 and modified it's crt1.S to relocate dynamic section prior to __uClibc_main. Disabled stack protector when compiling reloc_static_pie.c to avoid TLS access prior to it being setup. Signed-off-by: linted --- libc/sysdeps/linux/aarch64/crt1.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libc/sysdeps/linux/aarch64') diff --git a/libc/sysdeps/linux/aarch64/crt1.S b/libc/sysdeps/linux/aarch64/crt1.S index 09d0327ac..e9f946894 100644 --- a/libc/sysdeps/linux/aarch64/crt1.S +++ b/libc/sysdeps/linux/aarch64/crt1.S @@ -48,6 +48,20 @@ _start: mov x29, #0 mov x30, #0 +#ifdef L_rcrt1 + /* Save off the atexit pointer */ + mov x19, x0 + + /* Calculate load address... idk how this works, but it does */ + adrp x0, _start + + /* Do relocations */ + bl reloc_static_pie + + /* restore atexit pointer */ + mov x0, x19 +#endif + /* Setup _fini in argument register */ mov x5, x0 -- cgit v1.2.3