summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2010-07-21 23:54:15 -0700
committerKhem Raj <raj.khem@gmail.com>2010-07-21 23:54:15 -0700
commit48df53fd029ce8ccb9c254bd4a0f6c9bafca5196 (patch)
tree3ccc7827cb6f05cce4c00ee11ce31ff733fcceef
parent48fb264beaac8114e5ac3e80e70dda473fbce96d (diff)
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 <raj.khem@gmail.com>
-rw-r--r--libc/sysdeps/linux/arm/crt1.S11
1 files 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)