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".
This commit is contained in:
H.J. Lu 2017-10-03 17:54:13 -07:00
parent 02d2d8927d
commit 955774751b
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -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