Skip to content

Commit 31e541e

Browse files
committed
[sanitizer] Temporarily switch ppc64 to the _dl_get_tls_static_info implementation
sanitizer-ppc64le-linux is good while clang-ppc64le-linux has test failures due to GetStaticTlsRange(addr, size) set *addr is 0.
1 parent 38edd23 commit 31e541e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,15 @@ static void GetTls(uptr *addr, uptr *size) {
420420
#else
421421
if (SANITIZER_GLIBC)
422422
*size += 1664;
423-
#if defined(__mips__) || defined(__powerpc64__) || SANITIZER_RISCV64
423+
#if defined(__powerpc64__)
424+
// TODO Figure out why *addr may be zero and use TlsPreTcbSize.
425+
void *ptr = dlsym(RTLD_NEXT, "_dl_get_tls_static_info");
426+
uptr tls_size, tls_align;
427+
((void (*)(size_t *, size_t *))ptr)(&tls_size, &tls_align);
428+
asm("addi %0,13,-0x7000" : "=r"(*addr));
429+
*addr -= TlsPreTcbSize();
430+
*size = RoundUpTo(tls_size + TlsPreTcbSize(), 16);
431+
#elif defined(__mips__) || SANITIZER_RISCV64
424432
const uptr pre_tcb_size = TlsPreTcbSize();
425433
*addr -= pre_tcb_size;
426434
*size += pre_tcb_size;

0 commit comments

Comments
 (0)