[compiler-rt] r345632 - [CMake] Check -ffreestanding as C not C++ flag
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 30 12:19:47 PDT 2018
Author: phosek
Date: Tue Oct 30 12:19:47 2018
New Revision: 345632
URL: http://llvm.org/viewvc/llvm-project?rev=345632&view=rev
Log:
[CMake] Check -ffreestanding as C not C++ flag
When -ffreestanding is used, main() isn't considered special and
when compiled as C++ code it'll get mangled which makes the
compilation fail since main() will be undefined so this check will
never succeed.
Differential Revision: https://reviews.llvm.org/D49332
Modified:
compiler-rt/trunk/cmake/config-ix.cmake
Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=345632&r1=345631&r2=345632&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Tue Oct 30 12:19:47 2018
@@ -53,6 +53,7 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
endif ()
# CodeGen options.
+check_c_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
check_cxx_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG)
check_cxx_compiler_flag(-fno-builtin COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
@@ -64,7 +65,6 @@ check_cxx_compiler_flag(-fno-sanitize=sa
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG)
check_cxx_compiler_flag(-frtti COMPILER_RT_HAS_FRTTI_FLAG)
check_cxx_compiler_flag(-fno-rtti COMPILER_RT_HAS_FNO_RTTI_FLAG)
-check_cxx_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
check_cxx_compiler_flag(-std=c++11 COMPILER_RT_HAS_STD_CXX11_FLAG)
check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
More information about the llvm-commits
mailing list