[compiler-rt] 1d31ea6 - Fix LazyInitialization in tsan
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 24 17:59:38 PDT 2022
Author: zijunzhao
Date: 2022-10-25T00:59:03Z
New Revision: 1d31ea68c0cbc24d690a58c296b50b61595b6127
URL: https://github.com/llvm/llvm-project/commit/1d31ea68c0cbc24d690a58c296b50b61595b6127
DIFF: https://github.com/llvm/llvm-project/commit/1d31ea68c0cbc24d690a58c296b50b61595b6127.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 90164c893ee16..f0918d86d4ec3 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h
@@ -678,8 +678,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-commits
mailing list