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
This commit is contained in:
Dmitry Vyukov 2021-04-27 20:19:28 +02:00
parent e1021dd1fd
commit f69853ac40
1 changed files with 6 additions and 0 deletions

View File

@ -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})