From fc50eb41ad3d10c40f89a3ebc920a2e6a07fe375 Mon Sep 17 00:00:00 2001 From: Daniel Sanders Date: Tue, 2 Feb 2016 18:43:53 +0000 Subject: Re-commit r259512: [tsan] Add a libc++ and lit testsuite for each ${TSAN_SUPPORTED_ARCH}. Summary: This is a workaround to a problem in the 3.8 release that affects MIPS and possibly other targets where the default is not supported but a sibling is supported. When TSAN_SUPPORTED_ARCH is not empty, cmake currently attempts to build a tsan'd libcxx as well as test tsan for the default target regardless of whether the default target is supported or not. This causes problems on MIPS32 since tsan is supported for MIPS64 but not MIPS32. This patch causes cmake to only build the libcxx and run the lit test-suite for archictures in ${TSAN_SUPPORTED_ARCH} This re-commit fixes an issue where 'check-tsan' continued to look for the tsan'd libc++ in the directory it used to be built in. Reviewers: hans, samsonov Subscribers: tberghammer, llvm-commits, danalbert, srhines, dvyukov Differential Revision: http://reviews.llvm.org/D16685 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259542 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/tsan/CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/tsan/CMakeLists.txt') diff --git a/lib/tsan/CMakeLists.txt b/lib/tsan/CMakeLists.txt index 0e60cd346..c185cfa16 100644 --- a/lib/tsan/CMakeLists.txt +++ b/lib/tsan/CMakeLists.txt @@ -204,10 +204,17 @@ endif() # Build libcxx instrumented with TSan. if(COMPILER_RT_HAS_LIBCXX_SOURCES AND COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang") - set(LIBCXX_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libcxx_tsan) - add_custom_libcxx(libcxx_tsan ${LIBCXX_PREFIX} - DEPS ${TSAN_RUNTIME_LIBRARIES} - CFLAGS -fsanitize=thread) + set(libcxx_tsan_deps) + foreach(arch ${TSAN_SUPPORTED_ARCH}) + get_target_flags_for_arch(${arch} TARGET_CFLAGS) + set(LIBCXX_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libcxx_tsan_${arch}) + add_custom_libcxx(libcxx_tsan_${arch} ${LIBCXX_PREFIX} + DEPS ${TSAN_RUNTIME_LIBRARIES} + CFLAGS ${TARGET_CFLAGS} -fsanitize=thread) + list(APPEND libcxx_tsan_deps libcxx_tsan_${arch}) + endforeach() + + add_custom_target(libcxx_tsan DEPENDS ${libcxx_tsan_deps}) endif() if(COMPILER_RT_INCLUDE_TESTS) -- cgit v1.2.3