summaryrefslogtreecommitdiff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-08-08 21:34:25 +0000
committerJakub Jelinek <jakub@redhat.com>2005-08-08 21:34:25 +0000
commita6d1003497d92df2575894474fa1d2c0ee3f39f4 (patch)
tree6665a936728da87053845bdff9ff812ee58981ec /sysdeps/x86_64
parentc633e822b473e8135a36e413c5b79d7ce5a5d1fc (diff)
Updated to fedora-glibc-20050808T2126
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/dl-machine.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 335b38ab37..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"
- "0:\tleaq _dl_start(%%rip), %0\n\t"
- "subq %1, %0\n\t"
- ".section\t.data\n"
+ 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;
}