From: Vitaly Buka Date: Mon, 8 May 2023 18:03:40 +0000 (-0700) Subject: [NFC][ASAN] Hide placeholder buffer X-Git-Tag: upstream/17.0.6~9066 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15593613769f767e78310b08e57b0a93dda6643e;p=platform%2Fupstream%2Fllvm.git [NFC][ASAN] Hide placeholder buffer --- diff --git a/compiler-rt/lib/asan/asan_thread.cpp b/compiler-rt/lib/asan/asan_thread.cpp index 8d4b5c8..a1734a6 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;