summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>2016-09-21 05:44:06 +0000
committerJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>2016-09-21 05:44:06 +0000
commitb29784157250228f96aafdc277d3bbae4767d49e (patch)
treead4524e94abe1efbb7ac1826a3cdf014892b087e
parent0d57392ef3962e4e7cf909da33fb438560788d2c (diff)
downloadbcm5719-llvm-b29784157250228f96aafdc277d3bbae4767d49e.tar.gz
bcm5719-llvm-b29784157250228f96aafdc277d3bbae4767d49e.zip
[CMake] Rename back SIMPLE_SOURCE to compile as C++
This was changed in rL276151 and causes problems if the C++ compiler does not support the same arches as the C compiler. For the builtins, only the C compiler is tested in try_compile_only. Additionally, -fno-exceptions is passed in (if available) to work around the case where no libunwind is available. Differential Revision: https://reviews.llvm.org/D23654 llvm-svn: 282054
-rw-r--r--compiler-rt/cmake/Modules/CompilerRTUtils.cmake6
-rw-r--r--compiler-rt/cmake/config-ix.cmake2
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index ba2a7bcfcd2..3fa50c8ad99 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -132,8 +132,12 @@ macro(test_target_arch arch def)
try_compile_only(CAN_TARGET_${arch} ${TARGET_${arch}_CFLAGS})
else()
set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
+ set(FLAG_NO_EXCEPTIONS "")
+ if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
+ set(FLAG_NO_EXCEPTIONS " -fno-exceptions ")
+ endif()
try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
- COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}"
+ COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}"
OUTPUT_VARIABLE TARGET_${arch}_OUTPUT
CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${argstring}")
endif()
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 16e98422102..63f81cd30dd 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -92,7 +92,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.c)
+set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main() { printf(\"hello, world\"); }\n")
# Add $arch as supported with no additional flags.
OpenPOWER on IntegriCloud