[compiler-rt] r332679 - [CMake] Reland "Make simple source used for CMake checks a C file"
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Thu May 17 16:50:35 PDT 2018
Author: phosek
Date: Thu May 17 16:50:35 2018
New Revision: 332679
URL: http://llvm.org/viewvc/llvm-project?rev=332679&view=rev
Log:
[CMake] Reland "Make simple source used for CMake checks a C file"
The source being compiled is plain C, but using .cc extension forces it
to be compiled as C++ which requires a working C++ compiler including
C++ library which may not be the case when we're building compiler-rt
together with libcxx as part of runtimes build.
Differential Revision: https://reviews.llvm.org/D47031
Modified:
compiler-rt/trunk/CMakeLists.txt
compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
compiler-rt/trunk/cmake/config-ix.cmake
Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=332679&r1=332678&r2=332679&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Thu May 17 16:50:35 2018
@@ -145,6 +145,7 @@ if (SANITIZER_CXX_ABI STREQUAL "default"
set(SANITIZER_CXX_ABI_SYSTEM 1)
else()
set(SANITIZER_CXX_ABI_LIBNAME "libstdc++")
+ set(SANITIZER_CXX_ABI_SYSTEM 1)
endif()
else()
set(SANITIZER_CXX_ABI_LIBNAME "${SANITIZER_CXX_ABI}")
Modified: compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake?rev=332679&r1=332678&r2=332679&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTUtils.cmake Thu May 17 16:50:35 2018
@@ -144,8 +144,12 @@ macro(test_target_arch arch def)
endif()
set(SAVED_CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
+ if(SANITIZER_CXX_ABI_SYSTEM)
+ set(FLAG_LINK_LIBRARIES ${SANITIZER_CXX_ABI_LIBRARY})
+ endif()
try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}"
+ LINK_LIBRARIES ${FLAG_LINK_LIBRARIES}
OUTPUT_VARIABLE TARGET_${arch}_OUTPUT)
set(CMAKE_EXE_LINKER_FLAGS ${SAVED_CMAKE_EXE_LINKER_FLAGS})
endif()
Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=332679&r1=332678&r2=332679&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Thu May 17 16:50:35 2018
@@ -125,7 +125,7 @@ set(COMPILER_RT_SUPPORTED_ARCH)
# platform. We use the results of these tests to build only the various target
# runtime libraries supported by our current compilers cross-compiling
# abilities.
-set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
+set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.c)
file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main() { printf(\"hello, world\"); }\n")
# Detect whether the current target platform is 32-bit or 64-bit, and setup
More information about the llvm-commits
mailing list