Skip to content

Commit 0ad6c09

Browse files
committed
[sanitizer] Guard the whole ThreadDescriptorSize block with #if !SANITIZER_GO after D119007
The SANITIZER_GO code path reports an undefined symbol error for dlsym. ``` FAILED: projects/compiler-rt/lib/tsan/rtl/CMakeFiles/GotsanRuntimeCheck /tmp/RelA/projects/compiler-rt/lib/tsan/rtl/CMakeFiles/GotsanRuntimeCheck ``` (cherry picked from commit f0cdacd)
1 parent 7cfe202 commit 0ad6c09

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void InitTlsSize() { }
216216
// On glibc x86_64, ThreadDescriptorSize() needs to be precise due to the usage
217217
// of g_tls_size. On other targets, ThreadDescriptorSize() is only used by lsan
218218
// to get the pointer to thread-specific data keys in the thread control block.
219-
#if (SANITIZER_FREEBSD || SANITIZER_LINUX) && !SANITIZER_ANDROID
219+
#if (SANITIZER_FREEBSD || SANITIZER_LINUX) && !SANITIZER_ANDROID && !SANITIZER_GO
220220
// sizeof(struct pthread) from glibc.
221221
static atomic_uintptr_t thread_descriptor_size;
222222

@@ -319,7 +319,6 @@ static uptr TlsPreTcbSize() {
319319
}
320320
#endif
321321

322-
#if !SANITIZER_GO
323322
namespace {
324323
struct TlsBlock {
325324
uptr begin, end, align;
@@ -407,9 +406,8 @@ __attribute__((unused)) static void GetStaticTlsBoundary(uptr *addr, uptr *size,
407406
*addr = ranges[l].begin;
408407
*size = ranges[r - 1].end - ranges[l].begin;
409408
}
410-
#endif // !SANITIZER_GO
411409
#endif // (x86_64 || i386 || mips || ...) && (SANITIZER_FREEBSD ||
412-
// SANITIZER_LINUX) && !SANITIZER_ANDROID
410+
// SANITIZER_LINUX) && !SANITIZER_ANDROID && !SANITIZER_GO
413411

414412
#if SANITIZER_NETBSD
415413
static struct tls_tcb * ThreadSelfTlsTcb() {

0 commit comments

Comments
 (0)