sparc: Update elf_machine_load_address for static PIE
Commit Message
sparc uses a local label to compute load address, which works with static
PIE. We just need to return 0 if _DYNAMIC is undefined for static
executable.
OK for master?
* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_dynamic): Return
0 if _DYNAMIC is undefined for static executable.
* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_dynamic):
Likewise.
---
sysdeps/sparc/sparc32/dl-machine.h | 5 +++++
sysdeps/sparc/sparc64/dl-machine.h | 5 +++++
2 files changed, 10 insertions(+)
@@ -77,6 +77,11 @@ elf_machine_dynamic (void)
static inline Elf32_Addr
elf_machine_load_address (void)
{
+#ifndef SHARED
+ extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+ if (!_DYNAMIC)
+ return 0;
+#endif
register Elf32_Addr *pc __asm ("%o7"), *got __asm ("%l7");
__asm ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t"
@@ -66,6 +66,11 @@ elf_machine_dynamic (void)
static inline Elf64_Addr
elf_machine_load_address (void)
{
+#ifndef SHARED
+ extern Elf64_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
+ if (!_DYNAMIC)
+ return 0;
+#endif
register Elf32_Addr *pc __asm ("%o7");
register Elf64_Addr *got __asm ("%l7");