[compiler-rt] r239956 - [CMake] Remove redundant checks in TSan CMakeLists.txt

Alexey Samsonov vonosmas at gmail.com
Wed Jun 17 15:24:49 PDT 2015


Author: samsonov
Date: Wed Jun 17 17:24:49 2015
New Revision: 239956

URL: http://llvm.org/viewvc/llvm-project?rev=239956&view=rev
Log:
[CMake] Remove redundant checks in TSan CMakeLists.txt

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

Modified: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=239956&r1=239955&r2=239956&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Wed Jun 17 17:24:49 2015
@@ -82,54 +82,50 @@ set(TSAN_HEADERS
 
 set(TSAN_RUNTIME_LIBRARIES)
 add_custom_target(tsan)
-# TSan is currently supported on 64-bit Linux only.
-if(UNIX AND NOT APPLE)
-  foreach(arch ${TSAN_SUPPORTED_ARCH})
-    if(arch STREQUAL "x86_64")
-      set(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S)
-      # Pass ASM file directly to the C++ compiler.
-      set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
-        LANGUAGE C)
-      # Sanity check for Go runtime.
-      set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
-      add_custom_target(GotsanRuntimeCheck
-        COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
-                IN_TMPDIR=1 SILENT=1 ${BUILDGO_SCRIPT}
-        DEPENDS clang_rt.tsan-${arch} ${BUILDGO_SCRIPT}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
-        COMMENT "Checking TSan Go runtime..."
-        VERBATIM)
-    else()
-      set(TSAN_ASM_SOURCES)
-    endif()
-    add_compiler_rt_runtime(clang_rt.tsan-${arch} ${arch} STATIC
-      SOURCES ${TSAN_SOURCES} ${TSAN_ASM_SOURCES}
-              $<TARGET_OBJECTS:RTInterception.${arch}>
-              $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
-              $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
-              $<TARGET_OBJECTS:RTUbsan.${arch}>
-      CFLAGS ${TSAN_RTL_CFLAGS})
-    add_compiler_rt_runtime(clang_rt.tsan_cxx-${arch} ${arch} STATIC
-      SOURCES ${TSAN_CXX_SOURCES}
-              $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
-      CFLAGS ${TSAN_RTL_CFLAGS})
-    list(APPEND TSAN_RUNTIME_LIBRARIES clang_rt.tsan-${arch}
-                                       clang_rt.tsan_cxx-${arch})
-    add_sanitizer_rt_symbols(clang_rt.tsan-${arch} rtl/tsan.syms.extra)
-    add_sanitizer_rt_symbols(clang_rt.tsan_cxx-${arch} rtl/tsan.syms.extra)
-    add_dependencies(tsan clang_rt.tsan-${arch}
-                          clang_rt.tsan_cxx-${arch}
-                          clang_rt.tsan-${arch}-symbols
-                          clang_rt.tsan_cxx-${arch}-symbols)
-  endforeach()
-endif()
 
-add_dependencies(compiler-rt tsan)
+foreach(arch ${TSAN_SUPPORTED_ARCH})
+  if(arch STREQUAL "x86_64")
+    set(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S)
+    # Pass ASM file directly to the C++ compiler.
+    set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
+      LANGUAGE C)
+    # Sanity check for Go runtime.
+    set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh)
+    add_custom_target(GotsanRuntimeCheck
+      COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"
+              IN_TMPDIR=1 SILENT=1 ${BUILDGO_SCRIPT}
+      DEPENDS clang_rt.tsan-${arch} ${BUILDGO_SCRIPT}
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/go
+      COMMENT "Checking TSan Go runtime..."
+      VERBATIM)
+  else()
+    set(TSAN_ASM_SOURCES)
+  endif()
+  add_compiler_rt_runtime(clang_rt.tsan-${arch} ${arch} STATIC
+    SOURCES ${TSAN_SOURCES} ${TSAN_ASM_SOURCES}
+            $<TARGET_OBJECTS:RTInterception.${arch}>
+            $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
+            $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
+            $<TARGET_OBJECTS:RTUbsan.${arch}>
+    CFLAGS ${TSAN_RTL_CFLAGS})
+  add_compiler_rt_runtime(clang_rt.tsan_cxx-${arch} ${arch} STATIC
+    SOURCES ${TSAN_CXX_SOURCES}
+            $<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
+    CFLAGS ${TSAN_RTL_CFLAGS})
+  list(APPEND TSAN_RUNTIME_LIBRARIES clang_rt.tsan-${arch}
+                                     clang_rt.tsan_cxx-${arch})
+  add_sanitizer_rt_symbols(clang_rt.tsan-${arch} rtl/tsan.syms.extra)
+  add_sanitizer_rt_symbols(clang_rt.tsan_cxx-${arch} rtl/tsan.syms.extra)
+  add_dependencies(tsan clang_rt.tsan-${arch}
+                        clang_rt.tsan_cxx-${arch}
+                        clang_rt.tsan-${arch}-symbols
+                        clang_rt.tsan_cxx-${arch}-symbols)
+endforeach()
 
+add_dependencies(compiler-rt tsan)
 
 # Build libcxx instrumented with TSan.
-if(TSAN_SUPPORTED_ARCH AND
-   COMPILER_RT_HAS_LIBCXX_SOURCES AND
+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}





More information about the llvm-commits mailing list