[compiler-rt] 1559361 - [NFC][ASAN] Hide placeholder buffer

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 16:33:38 PDT 2023


Author: Vitaly Buka
Date: 2023-05-08T16:33:29-07:00
New Revision: 15593613769f767e78310b08e57b0a93dda6643e

URL: https://github.com/llvm/llvm-project/commit/15593613769f767e78310b08e57b0a93dda6643e
DIFF: https://github.com/llvm/llvm-project/commit/15593613769f767e78310b08e57b0a93dda6643e.diff

LOG: [NFC][ASAN] Hide placeholder buffer

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_thread.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp
index 8d4b5c80f76e..a1734a6f896d 100644
--- a/compiler-rt/lib/asan/asan_thread.cpp
+++ b/compiler-rt/lib/asan/asan_thread.cpp
@@ -40,11 +40,7 @@ void AsanThreadContext::OnFinished() {
   thread = nullptr;
 }
 
-// MIPS requires aligned address
-static ALIGNED(alignof(
-    ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
 static ThreadRegistry *asan_thread_registry;
-
 static Mutex mu_for_thread_context;
 static LowLevelAllocator allocator_for_thread_context;
 
@@ -63,6 +59,11 @@ static void InitThreads() {
   // in TSD and can't reliably tell when no more TSD destructors will
   // be called. It would be wrong to reuse AsanThreadContext for another
   // thread before all TSD destructors will be called for it.
+
+  // MIPS requires aligned address
+  static ALIGNED(alignof(
+      ThreadRegistry)) char thread_registry_placeholder[sizeof(ThreadRegistry)];
+
   asan_thread_registry =
       new (thread_registry_placeholder) ThreadRegistry(GetAsanThreadContext);
   initialized = true;


        


More information about the llvm-commits mailing list