aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/i386/start.S7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 01517c5..a8d731c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2017-10-03 H.J. Lu <hongjiu.lu@intel.com>
+ * sysdeps/i386/start.S: Replace "leal main@GOT(%ebx), %eax" with
+ "movl main@GOTOFF(%ebx), %eax".
+
+2017-10-03 H.J. Lu <hongjiu.lu@intel.com>
+
* sysdeps/i386/dl-machine.h (elf_machine_load_address): Don't
allow undefined _DYNAMIC in PIE libc.a.
* sysdeps/x86_64/dl-machine.h (elf_machine_load_address):
diff --git a/sysdeps/i386/start.S b/sysdeps/i386/start.S
index 375a93c..916fcd2 100644
--- a/sysdeps/i386/start.S
+++ b/sysdeps/i386/start.S
@@ -99,8 +99,11 @@ _start:
pushl main@GOT(%ebx)
# else
/* Avoid relocation in static PIE since _start is called before
- it is relocated. */
- leal main@GOTOFF(%ebx), %eax
+ it is relocated. Don't use "leal main@GOTOFF(%ebx), %eax"
+ since main may be in a shared object. Linker will convert
+ "movl main@GOT(%ebx), %eax" to "leal main@GOTOFF(%ebx), %eax"
+ if main is defined locally. */
+ movl main@GOT(%ebx), %eax
pushl %eax
# endif