diff options
author | Petr Hosek <phosek@chromium.org> | 2018-05-22 22:58:48 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2018-05-22 22:58:48 +0000 |
commit | 8b037333b56457457fb1e4e57c2390ec18ee45dd (patch) | |
tree | d7830bfc932a0a011276d395fadb8e7bc87e80dc /cmake/config-ix.cmake | |
parent | fb98f1095aa66e72ab36738c4eac597193de7a8a (diff) |
[CMake] Support builtins as Clang default rtlib in compiler-rt
Use compiler-rt builtins when selected as default Clang rtlib and avoid
explicitly passing -rtlib= flag to avoid the "argument unused during
compilation" warning.
This is a partial alternative to D47094 that does not rely on compiler
runtime checks.
Differential Revision: https://reviews.llvm.org/D47115
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333037 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/config-ix.cmake')
-rw-r--r-- | cmake/config-ix.cmake | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 55f693caf..240c2f371 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -13,7 +13,10 @@ function(check_linker_flag flag out_var) endfunction() check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC) -if (NOT SANITIZER_USE_COMPILER_RT) +if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "builtins") + include(HandleCompilerRT) + find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY) +else() if (ANDROID) check_library_exists(gcc __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_LIB) else() @@ -27,9 +30,7 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG) if (COMPILER_RT_HAS_LIBC) list(APPEND CMAKE_REQUIRED_LIBRARIES c) endif () - if (SANITIZER_USE_COMPILER_RT) - list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt) - find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY) + if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "builtins") list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}") elseif (COMPILER_RT_HAS_GCC_S_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) |