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
This commit is contained in:
John Baldwin 2021-11-17 15:50:55 -08:00
parent 201d0ebee3
commit b928e924f7
2 changed files with 6 additions and 11 deletions

View File

@ -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));
}

View File

@ -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);
}