forked from OSchip/llvm-project
[sanitizer] Correct GetTls for x32
Since x32 pointer size is 4 bytes, the self pointer offset in TCB: struct { void *tcb; dtv_t *dtv; void *self; ... should be 8, not 16. Fixes https://github.com/llvm/llvm-project/issues/55288 Differential Revision: https://reviews.llvm.org/D125025
This commit is contained in:
parent
d4555698f8
commit
b226894d47
|
@ -462,7 +462,11 @@ static void GetTls(uptr *addr, uptr *size) {
|
|||
#elif SANITIZER_GLIBC && defined(__x86_64__)
|
||||
// For aarch64 and x86-64, use an O(1) approach which requires relatively
|
||||
// precise ThreadDescriptorSize. g_tls_size was initialized in InitTlsSize.
|
||||
# if SANITIZER_X32
|
||||
asm("mov %%fs:8,%0" : "=r"(*addr));
|
||||
# else
|
||||
asm("mov %%fs:16,%0" : "=r"(*addr));
|
||||
# endif
|
||||
*size = g_tls_size;
|
||||
*addr -= *size;
|
||||
*addr += ThreadDescriptorSize();
|
||||
|
|
Loading…
Reference in New Issue