about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-03 17:54:13 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-03 17:54:30 -0700
commit955774751b71c4bc94029dd541ad9d34634ec995 (patch)
tree544c51fca2148ba93bf876fc0e714194a137dd89 /sysdeps
parent02d2d8927d2fd3815a9f3c5c767aa71a8a33408e (diff)
downloadglibc-955774751b71c4bc94029dd541ad9d34634ec995.tar.gz
glibc-955774751b71c4bc94029dd541ad9d34634ec995.tar.xz
glibc-955774751b71c4bc94029dd541ad9d34634ec995.zip
i386: Use "movl main@GOT(%ebx), %eax" in start.S
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.

	* sysdeps/i386/start.S: Replace "leal main@GOT(%ebx), %eax" with
	"movl main@GOTOFF(%ebx), %eax".
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/start.S7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/i386/start.S b/sysdeps/i386/start.S
index 375a93c15a..916fcd2f9a 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