aboutsummaryrefslogtreecommitdiff
path: root/glibc
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2014-12-10 20:25:42 -0800
committerAndrew Waterman <waterman@cs.berkeley.edu>2014-12-10 20:25:42 -0800
commit4c4fbe7703922735b33c263275990ff4881cd424 (patch)
treea68bf718bdc8bd5fbbdb98f906b9ac7bde047a7a /glibc
parent068be3c3ff14d5912838b849339706efb72d1e1d (diff)
downloadriscv-gnu-toolchain-4c4fbe7703922735b33c263275990ff4881cd424.zip
riscv-gnu-toolchain-4c4fbe7703922735b33c263275990ff4881cd424.tar.gz
riscv-gnu-toolchain-4c4fbe7703922735b33c263275990ff4881cd424.tar.bz2
binutils, glibc: avoid DT_TEXTREL in ld.so
ld.so was using a non-PIC reloc to get the link-time address of _DYNAMIC, which, while correct, causes the library to be flagged DT_TEXTREL. Avoid this by leveraging the fact that the static linker has put the link-time address of _DYNAMIC in the first GOT entry.
Diffstat (limited to 'glibc')
-rw-r--r--glibc/sysdeps/riscv/dl-machine.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/glibc/sysdeps/riscv/dl-machine.h b/glibc/sysdeps/riscv/dl-machine.h
index 4900c3d..9de255a 100644
--- a/glibc/sysdeps/riscv/dl-machine.h
+++ b/glibc/sysdeps/riscv/dl-machine.h
@@ -91,10 +91,8 @@ elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
static inline ElfW(Addr)
elf_machine_dynamic (void)
{
- ElfW(Addr) link_addr;
- asm ("lui %0, %%hi(_DYNAMIC)" : "=r"(link_addr));
- asm ("addi %0, %0, %%lo(_DYNAMIC)" : "+r"(link_addr));
- return link_addr;
+ extern ElfW(Addr) _GLOBAL_OFFSET_TABLE_ __attribute__((visibility("hidden")));
+ return _GLOBAL_OFFSET_TABLE_;
}
#define STRINGXP(X) __STRING(X)