[NFC][ASAN] Hide placeholder buffer
authorVitaly Buka <vitalybuka@google.com>
Mon, 8 May 2023 18:03:40 +0000 (11:03 -0700)
committerVitaly Buka <vitalybuka@google.com>
Mon, 8 May 2023 23:33:29 +0000 (16:33 -0700)
compiler-rt/lib/asan/asan_thread.cpp

index 8d4b5c8..a1734a6 100644 (file)
@@ -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;