summaryrefslogtreecommitdiff
path: root/cmake/Modules/CompilerRTDarwinUtils.cmake
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2015-11-20 18:45:42 +0000
committerChris Bieneman <beanz@apple.com>2015-11-20 18:45:42 +0000
commit854e1dbdc85049953c16abafeb81e243e20431e0 (patch)
treefbb1cdde474be99ac65feff7593c49ffd0bc7bbe /cmake/Modules/CompilerRTDarwinUtils.cmake
parent348b87746ffc52d28e742534b99f258e4841fe2f (diff)
downloadcompiler-rt-854e1dbdc85049953c16abafeb81e243e20431e0.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules/CompilerRTDarwinUtils.cmake')
-rw-r--r--cmake/Modules/CompilerRTDarwinUtils.cmake160
1 files changed, 79 insertions, 81 deletions
diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
index f2fbf3866..59d47d7f8 100644
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -343,96 +343,94 @@ macro(darwin_add_embedded_builtin_libraries)
# 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()
+ 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 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(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(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(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_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")
- 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()
+ 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)
- 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)
+
+ 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)
+ 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()
- 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()