From 482239199924666a5a9500f4147231139145bee5 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 14 Apr 2024 14:41:14 +0200 Subject: [PATCH 08/30] compiler-rt: lsan: basic musl fixes on various archs --- .../sanitizer_common/sanitizer_linux_libcdep.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp @@ -32,6 +32,14 @@ # define _DEFAULT_SOURCE # endif +#if defined(__powerpc__) +#define DTP_OFFSET 0x8000 +#elif SANITIZER_RISCV64 +#define DTP_OFFSET 0x800 +#else +#define DTP_OFFSET 0 +#endif + # if SANITIZER_NETBSD # // for __lwp_gettcb_fast() / __lwp_getprivate_fast() # define _RTLD_SOURCE @@ -469,6 +477,7 @@ static int CollectStaticTlsBlocks(struct dl_phdr_info *info, size_t size, begin = (uptr)__tls_get_addr(mod_and_off); # endif } + begin -= DTP_OFFSET; for (unsigned i = 0; i != info->dlpi_phnum; ++i) if (info->dlpi_phdr[i].p_type == PT_TLS) { static_cast *>(data)->push_back(