[compiler-rt] r252572 - [CMake] Temporary workaround to support building builtins on darwin with a toolchain that may not support all x86 and arm architectures.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 16:41:19 PST 2015


Author: cbieneman
Date: Mon Nov  9 18:41:18 2015
New Revision: 252572

URL: http://llvm.org/viewvc/llvm-project?rev=252572&view=rev
Log:
[CMake] Temporary workaround to support building builtins on darwin with a toolchain that may not support all x86 and arm architectures.

This is at least a little better than my first attempt. We still really need a way to do compile checks without linking.

Modified:
    compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake?rev=252572&r1=252571&r2=252572&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake Mon Nov  9 18:41:18 2015
@@ -344,6 +344,24 @@ macro(darwin_add_builtin_libraries)
 endmacro()
 
 function(darwin_add_embedded_builtin_libraries)
+  # this is a hacky opt-out. If you can't target both intel and arm
+  # architectures we bail here.
+  set(DARWIN_SOFT_FLOAT_ARCHS armv6m armv7m armv7em armv7)
+  set(DARWIN_HARD_FLOAT_ARCHS armv7em armv7)
+  if(NOT COMPILER_RT_SUPPORTED_ARCH MATCHES ".*armv.*")
+    return()
+  endif()
+
+  list(FIND COMPILER_RT_SUPPORTED_ARCH i386 i386_idx)
+  if(i386_idx GREATER -1)
+    list(APPEND DARWIN_HARD_FLOAT_ARCHS i386)
+  endif()
+
+  list(FIND COMPILER_RT_SUPPORTED_ARCH x86_64 x86_64_idx)
+  if(x86_64_idx GREATER -1)
+    list(APPEND DARWIN_HARD_FLOAT_ARCHS x86_64)
+  endif()
+
   set(MACHO_SYM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/macho_embedded)
   if(CMAKE_CONFIGURATION_TYPES)
     foreach(type ${CMAKE_CONFIGURATION_TYPES})
@@ -376,9 +394,6 @@ function(darwin_add_embedded_builtin_lib
   set(CFLAGS_armv7m "-target thumbv7-apple-darwin-eabi")
   set(CFLAGS_i386 "-march=pentium")
 
-  set(DARWIN_SOFT_FLOAT_ARCHS armv6m armv7m armv7em armv7)
-  set(DARWIN_HARD_FLOAT_ARCHS armv7em armv7 i386 x86_64)
-
   darwin_read_list_from_file(common_FUNCTIONS ${MACHO_SYM_DIR}/common.txt)
   darwin_read_list_from_file(thumb2_FUNCTIONS ${MACHO_SYM_DIR}/thumb2.txt)
   darwin_read_list_from_file(thumb2_64_FUNCTIONS ${MACHO_SYM_DIR}/thumb2-64.txt)




More information about the llvm-commits mailing list