From f4164a55c5c946c58b5691460436ae34ce6e428c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= Date: Wed, 19 Mar 2025 08:04:44 +0100 Subject: Use __ehdr_start as known zero link address symbol The _start symbol does not necessarily have to be on the first page of the application. But the __ehdr_start symbol is always at address zero for PIE binaries. Signed-off-by: Marcus Haehnel --- libc/sysdeps/linux/aarch64/crt1.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/linux/aarch64/crt1.S b/libc/sysdeps/linux/aarch64/crt1.S index e9f946894..965d3265d 100644 --- a/libc/sysdeps/linux/aarch64/crt1.S +++ b/libc/sysdeps/linux/aarch64/crt1.S @@ -52,8 +52,8 @@ _start: /* Save off the atexit pointer */ mov x19, x0 - /* Calculate load address... idk how this works, but it does */ - adrp x0, _start + /* "Calculate" load address. The link address of __ehdr_start is 0. */ + adrp x0, __ehdr_start /* Do relocations */ bl reloc_static_pie -- cgit v1.2.3