[PATCH] D49325: [CMake] Change the flag to use compiler-rt builtins to boolean

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 13 15:28:44 PDT 2018


phosek created this revision.
phosek added reviewers: morehouse, vitalybuka, beanz.
Herald added subscribers: Sanitizers, llvm-commits, mgorny, dberris.

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.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49325

Files:
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/config-ix.cmake


Index: compiler-rt/cmake/config-ix.cmake
===================================================================
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -13,7 +13,7 @@
 endfunction()
 
 check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
-if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "builtins")
+if (SANITIZER_USE_COMPILER_RT)
   include(HandleCompilerRT)
   find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY)
 else()
@@ -30,7 +30,7 @@
   if (COMPILER_RT_HAS_LIBC)
     list(APPEND CMAKE_REQUIRED_LIBRARIES c)
   endif ()
-  if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "builtins")
+  if (SANITIZER_USE_COMPILER_RT)
     list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}")
   elseif (COMPILER_RT_HAS_GCC_S_LIB)
     list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
Index: compiler-rt/CMakeLists.txt
===================================================================
--- compiler-rt/CMakeLists.txt
+++ compiler-rt/CMakeLists.txt
@@ -157,17 +157,14 @@
   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()
+if (FUCHSIA)
+  set(SANITIZER_DEFAULT_COMPILER_RT ON)
 else()
-  set(COMPILER_RT_RUNTIME_LIBRARY "${COMPILER_RT_RUNTIME}")
+  set(SANITIZER_DEFAULT_COMPILER_RT OFF)
 endif()
 
+option(SANITIZER_USE_COMPILER_RT "Use compiler-rt instead of libgcc" ${SANITIZER_DEFAULT_COMPILER_RT})
+
 include(config-ix)
 
 #================================
@@ -316,7 +313,7 @@
 # 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 (SANITIZER_USE_COMPILER_RT)
   list(APPEND SANITIZER_COMMON_LINK_LIBS ${COMPILER_RT_BUILTINS_LIBRARY})
 else()
   if (ANDROID)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49325.155514.patch
Type: text/x-patch
Size: 1927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180713/0abe81bf/attachment.bin>


More information about the llvm-commits mailing list