On 07/05/2018 02:24 PM, Andreas Schwab wrote:
On Jul 05 2018, Florian Weimer <fweimer@redhat.com> wrote:
I assume the intent here is that other code can be shared between PIE and
non-PIE executables. However, it's not clear to me why the symbol
_dl_relocate_static_pie has to be used in the address calculation.
Which address calculation?
This code in sysdeps/m68k/dl-machine.h (arm has something similar):
/* Return the run-time load address of the shared object. */
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;
}