This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix locating GOT for Thumb-2 PIE binaries


I've applied this patch to fix a problem with Thumb-2 PIE binaries,
where the GOT was located incorrectly because of an offset 8 that is
only correct for ARM mode.  I'll also put this on 2.10 branch.

diff --git a/ChangeLog.arm b/ChangeLog.arm
index 4fcce61..643a071 100644
--- a/ChangeLog.arm
+++ b/ChangeLog.arm
@@ -1,3 +1,8 @@
+2009-10-22  Julian Brown  <julian@codesourcery.com>
+
+	* sysdeps/arm/elf/start.S (_start): Avoid dependency on PC pipeline
+	offset.
+
 2009-10-03  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/unix/sysv/linux/arm/bits/fcntl.h: Define F_SETOWN_EX and
diff --git a/sysdeps/arm/elf/start.S b/sysdeps/arm/elf/start.S
index 0cf4339..d21102e 100644
--- a/sysdeps/arm/elf/start.S
+++ b/sysdeps/arm/elf/start.S
@@ -87,8 +87,8 @@ _start:
 
 #ifdef SHARED
 	ldr sl, .L_GOT
-.L_GOT_OFF:
-	add sl, pc, sl
+	adr a4, .L_GOT
+	add sl, sl, a4
 
 	ldr ip, .L_GOT+4	/* __libc_csu_fini */
 	ldr ip, [sl, ip]
@@ -125,7 +125,7 @@ _start:
 
 #ifdef SHARED
 .L_GOT:
-	.word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8)
+	.word _GLOBAL_OFFSET_TABLE_ - .L_GOT
 	.word __libc_csu_fini(GOT)
 	.word __libc_csu_init(GOT)
 	.word main(GOT)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]