aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/sparc/sparc32
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-27 03:23:45 +0000
committerRoland McGrath <roland@gnu.org>2002-09-27 03:23:45 +0000
commit8243d6f1b70a506419329c81d862b80e9104ca9b (patch)
tree162d6357e85a897c5710e4945d3e11c503811928 /sysdeps/sparc/sparc32
parent9a88a2d7b35b7f08c07a9a189a176e7ca49d82b4 (diff)
downloadglibc-8243d6f1b70a506419329c81d862b80e9104ca9b.zip
glibc-8243d6f1b70a506419329c81d862b80e9104ca9b.tar.gz
glibc-8243d6f1b70a506419329c81d862b80e9104ca9b.tar.bz2
2002-09-24 Jakub Jelinek <jakub@redhat.com>
* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_load_address): Don't rely on *r_offset of R_SPARC_RELATIVE reloc in .got to contain the addend. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_load_address): Use the same l_addr computation. * sysdeps/sparc/sparc64/configure.in: Removed. * sysdeps/sparc/sparc64/configure: Removed. * config.h.in (SPARC64_DYNAMIC_BEFORE_GOT): Remove.
Diffstat (limited to 'sysdeps/sparc/sparc32')
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 72258bb..51060b6 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -101,21 +101,20 @@ elf_machine_dynamic (void)
static inline Elf32_Addr
elf_machine_load_address (void)
{
- register Elf32_Addr pc __asm("%o7"), pic __asm("%l7"), got;
-
- LOAD_PIC_REG (pic);
-
- /* Utilize the fact that a local .got entry will be partially
- initialized at startup awaiting its RELATIVE fixup. */
-
- __asm("sethi %%hi(.Load_address),%1\n"
- ".Load_address:\n\t"
- "call 1f\n\t"
- "or %1,%%lo(.Load_address),%1\n"
- "1:\tld [%2+%1],%1"
- : "=r"(pc), "=r"(got) : "r"(pic));
-
- return pc - got;
+ register Elf32_Addr *pc __asm ("%o7"), *got __asm ("%l7");
+
+ __asm ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t"
+ "call 1f\n\t"
+ " add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t"
+ "call _DYNAMIC\n\t"
+ "call _GLOBAL_OFFSET_TABLE_\n"
+ "1:\tadd %1, %0, %1\n\t" : "=r" (pc), "=r" (got));
+
+ /* got is now l_addr + _GLOBAL_OFFSET_TABLE_
+ *got is _DYNAMIC
+ pc[2]*4 is l_addr + _DYNAMIC - (long)pc - 8
+ pc[3]*4 is l_addr + _GLOBAL_OFFSET_TABLE_ - (long)pc - 12 */
+ return (Elf32_Addr) got - *got + (pc[2] - pc[3]) * 4 - 4;
}
/* Set up the loaded object described by L so its unrelocated PLT