aarch64: fix elf_machine_dynamic compile error [BZ #29835]
Commit Message
elf_machine_dynamic compile error when compiling glibc with --enable-static-pie option turned on, static executables do not have symbol _DYNAMIC
Fixes: bca0f5cbc9257c13322b99e55235c4f21ba0bd82("aarch64: Make elf_machine_{load_address,dynamic} robust [BZ #28203]")
Signed-off-by linzhuorong <linzhuorong@huawei.com>
---
sysdeps/aarch64/dl-machine.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -53,8 +53,9 @@ elf_machine_load_address (void)
static inline ElfW(Addr) __attribute__ ((unused))
elf_machine_dynamic (void)
{
- extern ElfW(Dyn) _DYNAMIC[] attribute_hidden;
- return (ElfW(Addr)) _DYNAMIC - elf_machine_load_address ();
+ /* Declaring this hidden ensures that a PC-relative reference is uesed. */
+ extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden;
+ return _GLOBAL_OFFSET_TABLE_[0];
}
/* Set up the loaded object described by L so its unrelocated PLT