Prechádzať zdrojové kódy

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 <marcus.haehnel@kernkonzept.com>
Jan Klötzke 3 týždňov pred
rodič
commit
f4164a55c5
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      libc/sysdeps/linux/aarch64/crt1.S

+ 2 - 2
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