From 48df53fd029ce8ccb9c254bd4a0f6c9bafca5196 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 21 Jul 2010 23:54:15 -0700 Subject: [PATCH] arm/crt1.S: Avoid dependency on PC+4 or PC+8 * fix a problem with Thumb PIE binaries, where the GOT was located incorrectly because of an offset 8 Signed-off-by: Khem Raj --- libc/sysdeps/linux/arm/crt1.S | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S index 18e3686fa..f2d9507b8 100644 --- a/libc/sysdeps/linux/arm/crt1.S +++ b/libc/sysdeps/linux/arm/crt1.S @@ -133,7 +133,6 @@ _start: #ifdef __PIC__ ldr r4, .L_GOT -.L_GOT_OFF: adr r5, .L_GOT add r4, r5, r4 @@ -201,8 +200,8 @@ _start: #ifdef __PIC__ ldr sl, .L_GOT -.L_GOT_OFF: - add sl, pc, sl + adr a4, .L_GOT + add sl, sl, a4 ldr ip, .L_GOT+4 /* _fini */ ldr a1, [sl, ip] @@ -238,11 +237,7 @@ _start: #ifdef __PIC__ .L_GOT: -#ifdef __thumb__ - .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+4) -#else /* __thumb2__ */ - .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8) -#endif + .word _GLOBAL_OFFSET_TABLE_ - .L_GOT .word _fini(GOT) .word _init(GOT) .word main(GOT) -- 2.11.4.GIT