m68k: Update elf_machine_load_address for static PIE

When --enable-static-pie is used to configure glibc, we need to use
_dl_relocate_static_pie to compute load address in static PIE.

	* sysdeps/m68k/dl-machine.h (elf_machine_load_address): Use
	_dl_relocate_static_pie instead of _dl_start to compute load
	address in static PIE.
This commit is contained in:
H.J. Lu 2017-10-20 03:36:34 -07:00
parent 4027a4fda0
commit 9ba7e81028
2 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2017-10-20 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/m68k/dl-machine.h (elf_machine_load_address): Use
_dl_relocate_static_pie instead of _dl_start to compute load
address in static PIE.
2017-10-20 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/m68k/start.S (_start): Check PIC instead of SHARED.

View File

@ -51,9 +51,15 @@ static inline Elf32_Addr
elf_machine_load_address (void)
{
Elf32_Addr addr;
#ifdef SHARED
asm (PCREL_OP ("lea", "_dl_start", "%0", "%0", "%%pc") "\n\t"
"sub.l _dl_start@GOT.w(%%a5), %0"
: "=a" (addr));
#else
asm (PCREL_OP ("lea", "_dl_relocate_static_pie", "%0", "%0", "%%pc") "\n\t"
"sub.l _dl_relocate_static_pie@GOT.w(%%a5), %0"
: "=a" (addr));
#endif
return addr;
}