Author: zijunzhao Date: 2022-10-25T00:55:41Z New Revision: ed090295c51729bb41ef7acd5888ce2d9d1bd537
URL: https://github.com/llvm/llvm-project/commit/ed090295c51729bb41ef7acd5888ce2d9d1bd537 DIFF: https://github.com/llvm/llvm-project/commit/ed090295c51729bb41ef7acd5888ce2d9d1bd537.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 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits