[compiler-rt] [sanitizer_common] Provide dummy ThreadDescriptorSize on Solaris (PR #109285)

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 06:54:41 PDT 2024


https://github.com/rorth created https://github.com/llvm/llvm-project/pull/109285

Since 2c69a09bee94acca859a1adf5b04d01dc13f7295, the Solaris build is broken like
```
Undefined			first referenced
 symbol  			    in file
_ZN11__sanitizer20ThreadDescriptorSizeEv projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.i386.dir/sanitizer_linux_libcdep.cpp.o
```
The `ThreadDescriptorSize` reference is from `sanitizer_linux_libcdep.cpp` (`GetTls`), l.590.  This isn't actually needed on non-glibc targets AFAICS, so this patch provides a dummy to restore the build.

Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and `x86_64-pc-linux-gnu`.

>From 5cdaed5a490b0eb3eaaaf7c583424f224eb3e1f9 Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro at gcc.gnu.org>
Date: Thu, 19 Sep 2024 15:53:20 +0200
Subject: [PATCH] [sanitizer_common] Provide dummy ThreadDescriptorSize on
 Solaris

Since 2c69a09bee94acca859a1adf5b04d01dc13f7295, the Solaris build is broken
like
```
Undefined			first referenced
 symbol  			    in file
_ZN11__sanitizer20ThreadDescriptorSizeEv projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.i386.dir/sanitizer_linux_libcdep.cpp.o
```
The `ThreadDescriptorSize` reference is from `sanitizer_linux_libcdep.cpp`
(`GetTls`), l.590.  This isn't actually needed on non-glibc targets AFAICS,
so this patch provides a dummy to restore the build.

Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.
---
 compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
index aa156acd7b657a..4fc99197aae3d5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -226,7 +226,7 @@ static void GetGLibcVersion(int *major, int *minor, int *patch) {
 // sizeof(struct pthread) from glibc.
 static uptr thread_descriptor_size;
 
-// FIXME: Implementation is very GLIBC specific, but it's used by FREEBSD.
+// FIXME: Implementation is very GLIBC specific, but it's used by FreeBSD.
 static uptr ThreadDescriptorSizeFallback() {
 #    if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \
         SANITIZER_RISCV64
@@ -364,6 +364,7 @@ static uptr TlsPreTcbSize() {
 #    endif
 #  else   // (SANITIZER_FREEBSD || SANITIZER_GLIBC) && !SANITIZER_GO
 void InitTlsSize() {}
+uptr ThreadDescriptorSize() { return 0; }
 #  endif  // (SANITIZER_FREEBSD || SANITIZER_GLIBC) && !SANITIZER_GO
 
 #  if (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_SOLARIS) && \



More information about the llvm-commits mailing list