From 8243d6f1b70a506419329c81d862b80e9104ca9b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 27 Sep 2002 03:23:45 +0000 Subject: 2002-09-24 Jakub Jelinek * 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. --- sysdeps/sparc/sparc32/dl-machine.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'sysdeps/sparc/sparc32') diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 72258bbf16..51060b652a 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 -- cgit v1.2.3