[compiler-rt] 9b9ee34 - [NFC][sanitizer] Move/rename macro into sanitizer_platform.h

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 12:44:10 PST 2021


Author: Vitaly Buka
Date: 2021-12-08T12:43:56-08:00
New Revision: 9b9ee34d0ef73d7da404095a8472ee46f67f7055

URL: https://github.com/llvm/llvm-project/commit/9b9ee34d0ef73d7da404095a8472ee46f67f7055
DIFF: https://github.com/llvm/llvm-project/commit/9b9ee34d0ef73d7da404095a8472ee46f67f7055.diff

LOG: [NFC][sanitizer] Move/rename macro into sanitizer_platform.h

Folloup for D114934

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
    compiler-rt/lib/sanitizer_common/sanitizer_common.h
    compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
    compiler-rt/lib/sanitizer_common/sanitizer_platform.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
index f0a008a11eb0b..fd54357adbe44 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cpp
@@ -17,6 +17,7 @@
 #include "sanitizer_allocator_internal.h"
 #include "sanitizer_atomic.h"
 #include "sanitizer_common.h"
+#include "sanitizer_platform.h"
 
 namespace __sanitizer {
 
@@ -188,9 +189,8 @@ bool AllocatorMayReturnNull() {
 void SetAllocatorMayReturnNull(bool may_return_null) {
   atomic_store(&allocator_may_return_null, may_return_null,
                memory_order_relaxed);
-#ifdef START_BACKGROUND_THREAD_EARLY
-  MaybeStartBackgroudThread();
-#endif
+  if (SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL)
+    MaybeStartBackgroudThread();
 }
 
 void PrintHintAllocatorCannotReturnNull() {

diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index 929dac1abd1e0..db03a6bc73e02 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -934,12 +934,6 @@ void *internal_start_thread(void *(*func)(void*), void *arg);
 void internal_join_thread(void *th);
 void MaybeStartBackgroudThread();
 
-#if defined(__thumb__) && defined(__linux__)
-// Workaround for
-// https://lab.llvm.org/buildbot/#/builders/clang-thumbv7-full-2stage
-#  define START_BACKGROUND_THREAD_EARLY
-#endif
-
 // Make the compiler think that something is going on there.
 // Use this inside a loop that looks like memset/memcpy/etc to prevent the
 // compiler from recognising it and turning it into an actual call to

diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
index a5d9eef2c7e9c..13624a83865d7 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp
@@ -96,7 +96,7 @@ void MaybeStartBackgroudThread() {
   }
 }
 
-#  ifndef START_BACKGROUND_THREAD_EARLY
+#  if !SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL
 #    pragma clang diagnostic push
 // We avoid global-constructors to be sure that globals are ready when
 // sanitizers need them. This can happend before global constructors executed.

diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
index 3153de34e5a3f..6fc02e178b143 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
@@ -392,4 +392,12 @@
 #  endif
 #endif
 
+#if defined(__thumb__) && defined(__linux__)
+// Workaround for
+// https://lab.llvm.org/buildbot/#/builders/clang-thumbv7-full-2stage
+#  define SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL 1
+#else
+#  define SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL 0
+#endif
+
 #endif // SANITIZER_PLATFORM_H


        


More information about the llvm-commits mailing list