git: b928e924f74b - main - rtld-elf: Use _get_tp in __tls_get_addr for aarch64 and riscv64.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Nov 2021 00:04:28 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b928e924f74b0b8f882a9b735611421a93113640 commit b928e924f74b0b8f882a9b735611421a93113640 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-11-17 23:50:55 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2021-11-17 23:50:55 +0000 rtld-elf: Use _get_tp in __tls_get_addr for aarch64 and riscv64. Reviewed by: kib Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33047 --- libexec/rtld-elf/aarch64/reloc.c | 9 +++------ libexec/rtld-elf/riscv/reloc.c | 8 +++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c index 8cc66c87d698..f697e4a03054 100644 --- a/libexec/rtld-elf/aarch64/reloc.c +++ b/libexec/rtld-elf/aarch64/reloc.c @@ -534,11 +534,8 @@ allocate_initial_tls(Obj_Entry *objs) void * __tls_get_addr(tls_index* ti) { - char *p; - void *_tp; + Elf_Addr **dtvp; - __asm __volatile("mrs %0, tpidr_el0" : "=r" (_tp)); - p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset); - - return (p); + dtvp = _get_tp(); + return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset)); } diff --git a/libexec/rtld-elf/riscv/reloc.c b/libexec/rtld-elf/riscv/reloc.c index 1e749206e9b9..70db8379ade5 100644 --- a/libexec/rtld-elf/riscv/reloc.c +++ b/libexec/rtld-elf/riscv/reloc.c @@ -406,13 +406,11 @@ allocate_initial_tls(Obj_Entry *objs) void * __tls_get_addr(tls_index* ti) { - char *_tp; + Elf_Addr **dtvp; void *p; - __asm __volatile("mv %0, tp" : "=r" (_tp)); - - p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)_tp - TLS_TP_OFFSET - - TLS_TCB_SIZE), ti->ti_module, ti->ti_offset); + dtvp = _get_tp(); + p = tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset); return ((char*)p + TLS_DTV_OFFSET); }