summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>2016-08-19 06:46:00 +0000
committerJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>2016-08-19 06:46:00 +0000
commit68ca8edd87dd8dfffd882c66db28bb98df7e2b24 (patch)
tree0d88117d317645b27e76f2285a523a28f3f3cf64
parenteb30ef947680d412e2699754380a461c3943c9a6 (diff)
[CMake] Fix ASM building in llvm/runtimes
When compiler-rt's CMake is not directly invoked, it will currently not call project() and thus ASM will not be enabled. We also don't need to put the .S files through the C compiler then. Differential Revision: https://reviews.llvm.org/D23656 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279215 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt4
-rw-r--r--lib/tsan/CMakeLists.txt19
2 files changed, 2 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f72fb01fc..92eab598f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,14 +1,14 @@
# CMake build for CompilerRT.
#
# This build assumes that CompilerRT is checked out into the
-# 'projects/compiler-rt' inside of an LLVM tree.
+# 'projects/compiler-rt' or 'runtimes/compiler-rt' inside of an LLVM tree.
# Standalone build system for CompilerRT is not yet ready.
#
# An important constraint of the build is that it only produces libraries
# based on the ability of the host toolchain to target various platforms.
# Check if compiler-rt is built as a standalone project.
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
project(CompilerRT C CXX ASM)
set(COMPILER_RT_STANDALONE_BUILD TRUE)
endif()
diff --git a/lib/tsan/CMakeLists.txt b/lib/tsan/CMakeLists.txt
index 1ce582138..7cdfc8df7 100644
--- a/lib/tsan/CMakeLists.txt
+++ b/lib/tsan/CMakeLists.txt
@@ -101,13 +101,6 @@ set_target_properties(tsan PROPERTIES FOLDER "Compiler-RT Misc")
if(APPLE)
set(TSAN_ASM_SOURCES rtl/tsan_rtl_amd64.S)
- # Xcode will try to compile this file as C ('clang -x c'), and that will fail.
- if (${CMAKE_GENERATOR} STREQUAL "Xcode")
- enable_language(ASM)
- else()
- # Pass ASM file directly to the C++ compiler.
- set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES LANGUAGE C)
- endif()
add_compiler_rt_runtime(clang_rt.tsan
SHARED
OS ${TSAN_SUPPORTED_OS}
@@ -138,9 +131,6 @@ else()
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
@@ -152,19 +142,10 @@ else()
VERBATIM)
elseif(arch STREQUAL "aarch64")
set(TSAN_ASM_SOURCES rtl/tsan_rtl_aarch64.S)
- # Pass ASM file directly to the C++ compiler.
- set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
- LANGUAGE C)
elseif(arch MATCHES "powerpc64|powerpc64le")
set(TSAN_ASM_SOURCES rtl/tsan_rtl_ppc64.S)
- # Pass ASM file directly to the C++ compiler.
- set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
- LANGUAGE C)
elseif(arch MATCHES "mips64|mips64le")
set(TSAN_ASM_SOURCES rtl/tsan_rtl_mips64.S)
- # Pass ASM file directly to the C++ compiler.
- set_source_files_properties(${TSAN_ASM_SOURCES} PROPERTIES
- LANGUAGE C)
else()
set(TSAN_ASM_SOURCES)
endif()