mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-23 13:09:58 +08:00
ARM: Rewrite elf_machine_dynamic in pure C.
This commit is contained in:
parent
e8dd47916f
commit
1a0fc08754
@ -1,3 +1,8 @@
|
|||||||
|
2013-05-07 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* sysdeps/arm/dl-machine.h (elf_machine_dynamic): Use a plain C
|
||||||
|
reference to _GLOBAL_OFFSET_TABLE_ with an STV_HIDDEN declaration.
|
||||||
|
|
||||||
2013-05-06 Roland McGrath <roland@hack.frob.com>
|
2013-05-06 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
* sysdeps/arm/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Add missing sfi_breg.
|
* sysdeps/arm/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Add missing sfi_breg.
|
||||||
|
@ -39,30 +39,13 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
|
|||||||
|
|
||||||
|
|
||||||
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
|
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
|
||||||
first element of the GOT. We used to use the PIC register to do this
|
first element of the GOT. */
|
||||||
without a constant pool reference, but GCC 4.2 will use a pseudo-register
|
|
||||||
for the PIC base, so it may not be in r10. */
|
|
||||||
static inline Elf32_Addr __attribute__ ((unused))
|
static inline Elf32_Addr __attribute__ ((unused))
|
||||||
elf_machine_dynamic (void)
|
elf_machine_dynamic (void)
|
||||||
{
|
{
|
||||||
Elf32_Addr dynamic;
|
/* Declaring this hidden ensures that a PC-relative reference is used. */
|
||||||
#ifdef __thumb2__
|
extern const Elf32_Addr _GLOBAL_OFFSET_TABLE_[] attribute_hidden;
|
||||||
long tmp;
|
return _GLOBAL_OFFSET_TABLE_[0];
|
||||||
asm ("ldr\t%0, 1f\n\t"
|
|
||||||
"adr\t%1, 1f\n\t"
|
|
||||||
"ldr\t%0, [%0, %1]\n\t"
|
|
||||||
"b 2f\n"
|
|
||||||
".align 2\n"
|
|
||||||
"1: .word _GLOBAL_OFFSET_TABLE_ - 1b\n"
|
|
||||||
"2:" : "=r" (dynamic), "=r"(tmp));
|
|
||||||
#else
|
|
||||||
asm ("ldr %0, 2f\n"
|
|
||||||
"1: ldr %0, [pc, %0]\n"
|
|
||||||
"b 3f\n"
|
|
||||||
"2: .word _GLOBAL_OFFSET_TABLE_ - (1b+8)\n"
|
|
||||||
"3:" : "=r" (dynamic));
|
|
||||||
#endif
|
|
||||||
return dynamic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user