Message ID | 20170929213522.GP2482@gmail.com |
---|---|
State | New |
Headers | show |
Series | m68k: Update elf_machine_load_address for static PIE | expand |
On Sep 29 2017, "H.J. Lu" <hjl.tools@gmail.com> wrote: > * 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. Return 0 if _DYNAMIC is undefined for > static executable. Ok. Andreas.
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index fd8fb00103..a9a19009e5 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -51,9 +51,18 @@ 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 + extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden"))); + if (!_DYNAMIC) + return 0; + 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; }