[git commit master 1/1] arm/crt1.S: Avoid dependency on PC+4 or PC+8

Khem Raj raj.khem at gmail.com
Thu Jul 22 06:54:15 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=48df53fd029ce8ccb9c254bd4a0f6c9bafca5196
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

* 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 at gmail.com>
---
 libc/sysdeps/linux/arm/crt1.S |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S
index 18e3686..f2d9507 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)
-- 
1.7.1



More information about the uClibc-cvs mailing list