[compiler-rt] r253692 - [compiler-rt][cmake] Fix not lipo libclang_rt.cc_kext.a when building on OS X

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 10:45:43 PST 2015


Author: cbieneman
Date: Fri Nov 20 12:45:42 2015
New Revision: 253692

URL: http://llvm.org/viewvc/llvm-project?rev=253692&view=rev
Log:
[compiler-rt][cmake] Fix not lipo libclang_rt.cc_kext.a when building on OS X

Summary:

Fix r252525 - cmake configure failed to connect target builtins to target compiler-rt  because of early return call.

Patch by: Jacky Tsao (cao.zhong1)

Reviewers: beanz

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14747

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=253692&r1=253691&r2=253692&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake Fri Nov 20 12:45:42 2015
@@ -343,96 +343,94 @@ macro(darwin_add_embedded_builtin_librar
   # 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()
+  if(COMPILER_RT_SUPPORTED_ARCH MATCHES ".*armv.*")
+    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()
+    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)
+    set(MACHO_SYM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/macho_embedded)
 
-  set(CFLAGS "-Oz -Wall -fomit-frame-pointer -ffreestanding")
-  set(CMAKE_C_FLAGS "")
-  set(CMAKE_CXX_FLAGS "")
-  set(CMAKE_ASM_FLAGS "")
-
-  set(SOFT_FLOAT_FLAG -mfloat-abi=soft)
-  set(HARD_FLOAT_FLAG -mfloat-abi=hard)
-
-  set(ENABLE_PIC Off)
-  set(PIC_FLAG -fPIC)
-  set(STATIC_FLAG -static)
-
-  set(DARWIN_macho_embedded_ARCHS armv6m armv7m armv7em armv7 i386 x86_64)
-
-  set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
-    ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
-  set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
-    ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
-    
-  set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
-  set(CFLAGS_i386 "-march=pentium")
-
-  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)
-  darwin_read_list_from_file(arm_FUNCTIONS ${MACHO_SYM_DIR}/arm.txt)
-  darwin_read_list_from_file(i386_FUNCTIONS ${MACHO_SYM_DIR}/i386.txt)
-
-
-  set(armv6m_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS})
-  set(armv7m_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS})
-  set(armv7em_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS})
-  set(armv7_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS} ${thumb2_64_FUNCTIONS})
-  set(i386_FUNCTIONS ${common_FUNCTIONS} ${i386_FUNCTIONS})
-  set(x86_64_FUNCTIONS ${common_FUNCTIONS})
-
-  foreach(arch ${DARWIN_macho_embedded_ARCHS})
-    darwin_filter_builtin_sources(${arch}_filtered_sources
-      INCLUDE ${arch}_FUNCTIONS
-      ${${arch}_SOURCES})
-    if(NOT ${arch}_filtered_sources)
-      message("${arch}_SOURCES: ${${arch}_SOURCES}")
-      message("${arch}_FUNCTIONS: ${${arch}_FUNCTIONS}")
-      message(FATAL_ERROR "Empty filtered sources!")
-    endif()
-  endforeach()
+    set(CFLAGS "-Oz -Wall -fomit-frame-pointer -ffreestanding")
+    set(CMAKE_C_FLAGS "")
+    set(CMAKE_CXX_FLAGS "")
+    set(CMAKE_ASM_FLAGS "")
+
+    set(SOFT_FLOAT_FLAG -mfloat-abi=soft)
+    set(HARD_FLOAT_FLAG -mfloat-abi=hard)
+
+    set(ENABLE_PIC Off)
+    set(PIC_FLAG -fPIC)
+    set(STATIC_FLAG -static)
+
+    set(DARWIN_macho_embedded_ARCHS armv6m armv7m armv7em armv7 i386 x86_64)
+
+    set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
+      ${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
+    set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
+      ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
+      
+    set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
+    set(CFLAGS_i386 "-march=pentium")
+
+    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)
+    darwin_read_list_from_file(arm_FUNCTIONS ${MACHO_SYM_DIR}/arm.txt)
+    darwin_read_list_from_file(i386_FUNCTIONS ${MACHO_SYM_DIR}/i386.txt)
+
+
+    set(armv6m_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS})
+    set(armv7m_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS})
+    set(armv7em_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS})
+    set(armv7_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS} ${thumb2_64_FUNCTIONS})
+    set(i386_FUNCTIONS ${common_FUNCTIONS} ${i386_FUNCTIONS})
+    set(x86_64_FUNCTIONS ${common_FUNCTIONS})
+
+    foreach(arch ${DARWIN_macho_embedded_ARCHS})
+      darwin_filter_builtin_sources(${arch}_filtered_sources
+        INCLUDE ${arch}_FUNCTIONS
+        ${${arch}_SOURCES})
+      if(NOT ${arch}_filtered_sources)
+        message("${arch}_SOURCES: ${${arch}_SOURCES}")
+        message("${arch}_FUNCTIONS: ${${arch}_FUNCTIONS}")
+        message(FATAL_ERROR "Empty filtered sources!")
+      endif()
+    endforeach()
 
-  foreach(float_type SOFT HARD)
-    foreach(type PIC STATIC)
-      string(TOLOWER "${float_type}_${type}" lib_suffix)
-      foreach(arch ${DARWIN_${float_type}_FLOAT_ARCHS})
-        set(DARWIN_macho_embedded_SYSROOT ${DARWIN_osx_SYSROOT})
-        set(float_flag)
-        if(${arch} MATCHES "^arm")
-          # x86 targets are hard float by default, but the complain about the
-          # float ABI flag, so don't pass it unless we're targeting arm.
-          set(float_flag ${${float_type}_FLOAT_FLAG})
-        endif()
-        darwin_add_builtin_library(clang_rt ${lib_suffix}
-                              OS macho_embedded
-                              ARCH ${arch}
-                              SOURCES ${${arch}_filtered_sources}
-                              CFLAGS ${CFLAGS} -arch ${arch} ${${type}_FLAG} ${float_flag} ${CFLAGS_${arch}}
-                              PARENT_TARGET builtins)
+    foreach(float_type SOFT HARD)
+      foreach(type PIC STATIC)
+        string(TOLOWER "${float_type}_${type}" lib_suffix)
+        foreach(arch ${DARWIN_${float_type}_FLOAT_ARCHS})
+          set(DARWIN_macho_embedded_SYSROOT ${DARWIN_osx_SYSROOT})
+          set(float_flag)
+          if(${arch} MATCHES "^arm")
+            # x86 targets are hard float by default, but the complain about the
+            # float ABI flag, so don't pass it unless we're targeting arm.
+            set(float_flag ${${float_type}_FLOAT_FLAG})
+          endif()
+          darwin_add_builtin_library(clang_rt ${lib_suffix}
+                                OS macho_embedded
+                                ARCH ${arch}
+                                SOURCES ${${arch}_filtered_sources}
+                                CFLAGS ${CFLAGS} -arch ${arch} ${${type}_FLAG} ${float_flag} ${CFLAGS_${arch}}
+                                PARENT_TARGET builtins)
+        endforeach()
+        foreach(lib ${macho_embedded_${lib_suffix}_libs})
+          set_target_properties(${lib} PROPERTIES LINKER_LANGUAGE C)
+        endforeach()
+        darwin_lipo_libs(clang_rt.${lib_suffix}
+                      PARENT_TARGET builtins
+                      LIPO_FLAGS ${macho_embedded_${lib_suffix}_lipo_flags}
+                      DEPENDS ${macho_embedded_${lib_suffix}_libs}
+                      OUTPUT_DIR ${DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR}
+                      INSTALL_DIR ${DARWIN_macho_embedded_LIBRARY_INSTALL_DIR})
       endforeach()
-      foreach(lib ${macho_embedded_${lib_suffix}_libs})
-        set_target_properties(${lib} PROPERTIES LINKER_LANGUAGE C)
-      endforeach()
-      darwin_lipo_libs(clang_rt.${lib_suffix}
-                    PARENT_TARGET builtins
-                    LIPO_FLAGS ${macho_embedded_${lib_suffix}_lipo_flags}
-                    DEPENDS ${macho_embedded_${lib_suffix}_libs}
-                    OUTPUT_DIR ${DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR}
-                    INSTALL_DIR ${DARWIN_macho_embedded_LIBRARY_INSTALL_DIR})
     endforeach()
-  endforeach()
+  endif()
 endmacro()




More information about the llvm-commits mailing list