[llvm-branch-commits] [compiler-rt] 3da11a8 - Fix LazyInitialization in tsan
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Oct 24 17:57:20 PDT 2022
Author: zijunzhao
Date: 2022-10-25T00:19:03Z
New Revision: 3da11a80d323b1607b95270b0d2ba5031711c1d8
URL: https://github.com/llvm/llvm-project/commit/3da11a80d323b1607b95270b0d2ba5031711c1d8
DIFF: https://github.com/llvm/llvm-project/commit/3da11a80d323b1607b95270b0d2ba5031711c1d8.diff
LOG: Fix LazyInitialization in tsan
In Android, further initialization is always necessary whether preinit_array can be used.
LazyInitialize is needed regardless of .preinit_array support on platforms where runtime is loaded as dynamic library, e.g. Android.
Reviewed By: dvyukov, vitalybuka
Differential Revision: https://reviews.llvm.org/D135925
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_rtl.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
index 7788c3508c38c..3a9ef323f555a 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
@@ -666,8 +666,8 @@ ALWAYS_INLINE
void LazyInitialize(ThreadState *thr) {
// If we can use .preinit_array, assume that __tsan_init
// called from .preinit_array initializes runtime before
- // any instrumented code.
-#if !SANITIZER_CAN_USE_PREINIT_ARRAY
+ // any instrumented code except ANDROID.
+#if (!SANITIZER_CAN_USE_PREINIT_ARRAY || defined(__ANDROID__))
if (UNLIKELY(!is_initialized))
Initialize(thr);
#endif
More information about the llvm-branch-commits
mailing list