[PATCH] D26653: [compiler-rt] Support building builtins for a single target

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 16:53:05 PST 2016


phosek created this revision.
phosek added a reviewer: beanz.
phosek added a subscriber: llvm-commits.
phosek set the repository for this revision to rL LLVM.
Herald added subscribers: mgorny, dberris.

This is used when building builtins for multiple targets as part of LLVM runtimes.


Repository:
  rL LLVM

https://reviews.llvm.org/D26653

Files:
  cmake/Modules/CompilerRTUtils.cmake
  cmake/base-config-ix.cmake


Index: cmake/base-config-ix.cmake
===================================================================
--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -84,6 +84,8 @@
   option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
   option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
   option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)
+else()
+  option(COMPILER_RT_DEFAULT_TARGET_ONLY "Build builtins only for the default target" Off)
 endif()
 
 if(WIN32 AND NOT MINGW AND NOT CYGWIN)
@@ -127,7 +129,9 @@
     detect_target_arch()
     set(COMPILER_RT_OS_SUFFIX "-android")
   elseif(NOT APPLE) # Supported archs for Apple platforms are generated later
-    if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64")
+    if(COMPILER_RT_DEFAULT_TARGET_ONLY)
+      test_target_arch(${COMPILER_RT_DEFAULT_TARGET_ARCH} "" "")
+    elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64")
       if(NOT MSVC)
         test_target_arch(x86_64 "" "-m64")
         # FIXME: We build runtimes for both i686 and i386, as "clang -m32" may
Index: cmake/Modules/CompilerRTUtils.cmake
===================================================================
--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -223,7 +223,13 @@
 endmacro()
 
 macro(construct_compiler_rt_default_triple)
-  set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${TARGET_TRIPLE} CACHE STRING
+  set(COMPILER_RT_COMPILER_TARGET "")
+  if(DEFINED CMAKE_C_COMPILER_TARGET)
+    set(COMPILER_RT_COMPILER_TARGET ${CMAKE_C_COMPILER_TARGET})
+  else()
+    set(COMPILER_RT_COMPILER_TARGET ${TARGET_TRIPLE})
+  endif()
+  set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${COMPILER_RT_COMPILER_TARGET} CACHE STRING
       "Default triple for which compiler-rt runtimes will be built.")
   if(DEFINED COMPILER_RT_TEST_TARGET_TRIPLE)
     # Backwards compatibility: this variable used to be called


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26653.77920.patch
Type: text/x-patch
Size: 1964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/28d15a08/attachment.bin>


More information about the llvm-commits mailing list