This patch fix the function GetTls for aarch64, where it assumes it
follows the x86_64 way where the TLS initial address is at the end
of TLS. Instead aarch64 set the TLS address as the thread pointer.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
To give you more context on GLIBC code for aarch64:
sysdeps/aarch64/nptl/tls.h:
49 /* The TP points to the start of the thread blocks. */
50 # define TLS_DTV_AT_TP 1
51 # define TLS_TCB_AT_TP 0
93 # define TLS_INIT_TP(tcbp) \
94 ({ asm volatile ("msr tpidr_el0, %0" : : "r" (tcbp)); NULL; })
And on:
csu/libc-tls.c:
/* Initialize the thread pointer. */
#if TLS_TCB_AT_TP
INSTALL_DTV ((char *) tlsblock + tcb_offset, _dl_static_dtv); const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset);
#elif TLS_DTV_AT_TP
INSTALL_DTV (tlsblock, _dl_static_dtv); const char *lossage = TLS_INIT_TP (tlsblock);
So different than x86_64 (which defines TLS_TCB_AT_TP), aarch64 set the thread register pointers as the TLS allocated block.