[compiler-rt] r337116 - [CMake] Change the flag to use compiler-rt builtins to boolean

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 14 20:05:20 PDT 2018


Author: phosek
Date: Sat Jul 14 20:05:20 2018
New Revision: 337116

URL: http://llvm.org/viewvc/llvm-project?rev=337116&view=rev
Log:
[CMake] Change the flag to use compiler-rt builtins to boolean

This changes the name and the type to what it was prior to r333037
which matches the name of the flag used in other runtimes: libc++,
libc++abi and libunwind. We don't need the type to be a string since
there's only binary choice between libgcc and compiler-rt unlike in
the case of C++ library where there're multiple options.

Differential Revision: https://reviews.llvm.org/D49325

Modified:
    compiler-rt/trunk/CMakeLists.txt
    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=337116&r1=337115&r2=337116&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Sat Jul 14 20:05:20 2018
@@ -157,17 +157,14 @@ else()
   set(SANITIZER_CXX_ABI_SYSTEM 1)
 endif()
 
-set(COMPILER_RT_RUNTIME "default" CACHE STRING
-    "Compiler runtime to use.")
-
-if (COMPILER_RT_RUNTIME STREQUAL "default")
-  if (FUCHSIA)
-    set(COMPILER_RT_RUNTIME_LIBRARY "builtins")
-  endif()
-else()
-  set(COMPILER_RT_RUNTIME_LIBRARY "${COMPILER_RT_RUNTIME}")
+set(DEFAULT_COMPILER_RT_USE_BUILTINS_LIBRARY OFF)
+if (FUCHSIA)
+  set(DEFAULT_COMPILER_RT_USE_BUILTINS_LIBRARY ON)
 endif()
 
+option(COMPILER_RT_USE_BUILTINS_LIBRARY
+  "Use compiler-rt builtins instead of libgcc" ${DEFAULT_COMPILER_RT_USE_BUILTINS_LIBRARY})
+
 include(config-ix)
 
 #================================
@@ -316,7 +313,7 @@ append_list_if(COMPILER_RT_HAS_WD4800_FL
 # Set common link flags.
 append_list_if(COMPILER_RT_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs SANITIZER_COMMON_LINK_FLAGS)
 
-if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "builtins")
+if (COMPILER_RT_USE_BUILTINS_LIBRARY)
   list(APPEND SANITIZER_COMMON_LINK_LIBS ${COMPILER_RT_BUILTINS_LIBRARY})
 else()
   if (ANDROID)

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=337116&r1=337115&r2=337116&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Sat Jul 14 20:05:20 2018
@@ -13,7 +13,7 @@ function(check_linker_flag flag out_var)
 endfunction()
 
 check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
-if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "builtins")
+if (COMPILER_RT_USE_BUILTINS_LIBRARY)
   include(HandleCompilerRT)
   find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY)
 else()
@@ -30,7 +30,7 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
   if (COMPILER_RT_HAS_LIBC)
     list(APPEND CMAKE_REQUIRED_LIBRARIES c)
   endif ()
-  if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "builtins")
+  if (COMPILER_RT_USE_BUILTINS_LIBRARY)
     list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}")
   elseif (COMPILER_RT_HAS_GCC_S_LIB)
     list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)




More information about the llvm-commits mailing list