[compiler-rt] 2c69a09 - [NFC][sanitizer] Move ThreadDescriptorSize into GLIBC/FREEBSD block (#108913)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 10:50:17 PDT 2024


Author: Vitaly Buka
Date: 2024-09-17T10:50:14-07:00
New Revision: 2c69a09bee94acca859a1adf5b04d01dc13f7295

URL: https://github.com/llvm/llvm-project/commit/2c69a09bee94acca859a1adf5b04d01dc13f7295
DIFF: https://github.com/llvm/llvm-project/commit/2c69a09bee94acca859a1adf5b04d01dc13f7295.diff

LOG: [NFC][sanitizer] Move ThreadDescriptorSize into GLIBC/FREEBSD block (#108913)

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
index 2c64509d578b94..5829692531e8d0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -244,11 +244,11 @@ void InitTlsSize() {}
 // On glibc x86_64, ThreadDescriptorSize() needs to be precise due to the usage
 // of g_tls_size. On other targets, ThreadDescriptorSize() is only used by lsan
 // to get the pointer to thread-specific data keys in the thread control block.
-#  if (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_SOLARIS) && \
-      !SANITIZER_ANDROID && !SANITIZER_GO
+#  if (SANITIZER_FREEBSD || SANITIZER_GLIBC) && !SANITIZER_GO
 // sizeof(struct pthread) from glibc.
 static atomic_uintptr_t thread_descriptor_size;
 
+// FIXME: Implementation is very GLIBC specific, but it's used by FREEBSD.
 static uptr ThreadDescriptorSizeFallback() {
 #    if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
   int major;
@@ -363,6 +363,10 @@ static uptr TlsPreTcbSize() {
 }
 #    endif
 
+#  endif
+
+#  if (SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_SOLARIS) && \
+      !SANITIZER_ANDROID && !SANITIZER_GO
 namespace {
 struct TlsBlock {
   uptr begin, end, align;


        


More information about the llvm-commits mailing list