This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

[PATCH] 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.

Any comments?

H.J.
---
	* sysdeps/i386/start.S: Replace "leal main@GOT(%ebx), %eax" with
	"movl main@GOTOFF(%ebx), %eax".
---
 sysdeps/i386/start.S | 7 +++++--
 1 file 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
 
-- 
2.13.6


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