diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-07-31 17:50:49 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-07-31 17:50:49 +0000 |
commit | 943525d000abb3ddcbffe52923f653913073298e (patch) | |
tree | ae891bb69e88c5042a0cbe08961b52fda174947e /sysdeps/x86_64 | |
parent | 960095134b82c023a53f082d80f8811172108af2 (diff) | |
download | glibc-943525d000abb3ddcbffe52923f653913073298e.tar glibc-943525d000abb3ddcbffe52923f653913073298e.tar.gz glibc-943525d000abb3ddcbffe52923f653913073298e.tar.bz2 glibc-943525d000abb3ddcbffe52923f653913073298e.zip |
helper variable into .data.rel.ro. Simplify the code. Extend
comment to explain prelinking.
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r-- | sysdeps/x86_64/dl-machine.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 40291be08c..73e271775a 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -55,7 +55,7 @@ elf_machine_dynamic (void) static inline Elf64_Addr __attribute__ ((unused)) elf_machine_load_address (void) { - register Elf64_Addr addr, tmp; + Elf64_Addr addr; /* The easy way is just the same as on x86: leaq _dl_start, %0 @@ -66,15 +66,18 @@ elf_machine_load_address (void) Instead we store the address of _dl_start in the data section and compare it with the current value that we can get via - an RIP relative addressing mode. */ - - asm ("movq 1f(%%rip), %1\n" - "leaq _dl_start(%%rip), %0\n\t" - "subq %1, %0\n\t" + an RIP relative addressing mode. Note that this is the address + of _dl_start before any relocation performed at runtime. In case + the binary is prelinked the resulting "address" is actually a + load offset which is zero if the binary was loaded at the address + it is prelinked for. */ + + asm ("leaq _dl_start(%%rip), %0\n\t" + "subq 1f(%%rip), %0\n\t" ".section\t.data.rel.ro\n" "1:\t.quad _dl_start\n\t" ".previous\n\t" - : "=r" (addr), "=r" (tmp) : : "cc"); + : "=r" (addr) : : "cc"); return addr; } |