From ae11f049fc55c63a79b95ce0de69a1aee0d53faf Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 17 Mar 2024 18:01:24 +0100 Subject: riscv64: sync with glibc, fix all TLS errors in uClibc-ng-test --- ldso/ldso/riscv64/dl-sysdep.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'ldso/ldso/riscv64/dl-sysdep.h') diff --git a/ldso/ldso/riscv64/dl-sysdep.h b/ldso/ldso/riscv64/dl-sysdep.h index 91a45af46..01f3e49bf 100644 --- a/ldso/ldso/riscv64/dl-sysdep.h +++ b/ldso/ldso/riscv64/dl-sysdep.h @@ -58,23 +58,20 @@ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); || (__WORDSIZE == 64 && (type) == R_RISCV_TLS_TPREL64))) \ | (ELF_RTYPE_CLASS_COPY * ((type) == R_RISCV_COPY))) - -/* Return the link-time address of _DYNAMIC. */ +/* Return the run-time load address of the shared object. */ static inline ElfW(Addr) -elf_machine_dynamic (void) +elf_machine_load_address (void) { - extern ElfW(Addr) _GLOBAL_OFFSET_TABLE_ __attribute__ ((visibility ("hidden"))); - return _GLOBAL_OFFSET_TABLE_; + extern const ElfW(Ehdr) __ehdr_start attribute_hidden; + return (ElfW(Addr)) &__ehdr_start; } - -/* Return the run-time load address of the shared object. */ -static __always_inline ElfW(Addr) __attribute__ ((unused)) -elf_machine_load_address (void) +/* Return the link-time address of _DYNAMIC. */ +static inline ElfW(Addr) +elf_machine_dynamic (void) { - ElfW(Addr) load_addr; - __asm__ ("lla %0, _DYNAMIC" : "=r" (load_addr)); - return load_addr - elf_machine_dynamic (); + extern ElfW(Dyn) _DYNAMIC[] attribute_hidden; + return (ElfW(Addr)) _DYNAMIC - elf_machine_load_address (); } static __always_inline void -- cgit v1.2.3