[compiler-rt] f69853a - tsan: fix build with COMPILER_RT_TSAN_DEBUG_OUTPUT

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 13:39:01 PDT 2021


Author: Dmitry Vyukov
Date: 2021-04-27T22:38:56+02:00
New Revision: f69853ac40ba1b8cd119fc49091cb7216da81b38

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

LOG: 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

Added: 
    

Modified: 
    compiler-rt/lib/tsan/tests/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt
index 5d27e134555ac..56a4278f363cb 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})


        


More information about the llvm-commits mailing list