From f69853ac40ba1b8cd119fc49091cb7216da81b38 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 27 Apr 2021 20:19:28 +0200 Subject: [PATCH] tsan: fix build with COMPILER_RT_TSAN_DEBUG_OUTPUT COMPILER_RT_TSAN_DEBUG_OUTPUT enables TSAN_COLLECT_STATS, which changes layout of runtime structs (some structs contain stats when the option is enabled). It's not OK to build runtime with the define, but tests without it. The error is detected by build_consistency_stats/nostats. Fix this by defining TSAN_COLLECT_STATS for tests to match the runtime. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D101386 --- compiler-rt/lib/tsan/tests/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler-rt/lib/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt index 5d27e13..56a4278 100644 --- a/compiler-rt/lib/tsan/tests/CMakeLists.txt +++ b/compiler-rt/lib/tsan/tests/CMakeLists.txt @@ -14,6 +14,12 @@ set(TSAN_UNITTEST_CFLAGS -fno-rtti ) +if(COMPILER_RT_TSAN_DEBUG_OUTPUT) + # Need to match these flags with the runtime. + list(APPEND TSAN_UNITTEST_CFLAGS -DTSAN_COLLECT_STATS=1 + -DTSAN_DEBUG_OUTPUT=2) +endif() + set(TSAN_TEST_ARCH ${TSAN_SUPPORTED_ARCH}) set(LINK_FLAGS ${COMPILER_RT_UNITTEST_LINK_FLAGS}) -- 2.7.4