[compiler-rt] r248850 - [CMake] [Darwin] Support building the macho_embedded builtin libraries.
Chris Bieneman via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 16:13:45 PDT 2015
Author: cbieneman
Date: Tue Sep 29 18:13:45 2015
New Revision: 248850
URL: http://llvm.org/viewvc/llvm-project?rev=248850&view=rev
Log:
[CMake] [Darwin] Support building the macho_embedded builtin libraries.
Summary: This ports functionality from the clang_macho_embedded.mk platform makefile over to CMake.
Reviewers: bogner, samsonov, bob.wilson
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13226
Added:
compiler-rt/trunk/lib/builtins/macho_embedded/
compiler-rt/trunk/lib/builtins/macho_embedded/arm.txt
compiler-rt/trunk/lib/builtins/macho_embedded/common.txt
compiler-rt/trunk/lib/builtins/macho_embedded/i386.txt
compiler-rt/trunk/lib/builtins/macho_embedded/thumb2.txt
Modified:
compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake
compiler-rt/trunk/lib/builtins/CMakeLists.txt
Modified: compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake?rev=248850&r1=248849&r2=248850&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake Tue Sep 29 18:13:45 2015
@@ -100,8 +100,6 @@ function(darwin_filter_host_archs input
set(${output} ${tmp_var} PARENT_SCOPE)
endfunction()
-set(DARWIN_EXCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/builtins/Darwin-excludes)
-
# Read and process the exclude file into a list of symbols
function(darwin_read_list_from_file output_var file)
if(EXISTS ${file})
@@ -233,6 +231,8 @@ endfunction()
# Generates builtin libraries for all operating systems specified in ARGN. Each
# OS library is constructed by lipo-ing together single-architecture libraries.
macro(darwin_add_builtin_libraries)
+ set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes)
+
if(CMAKE_CONFIGURATION_TYPES)
foreach(type ${CMAKE_CONFIGURATION_TYPES})
set(CMAKE_C_FLAGS_${type} -O3)
@@ -310,5 +310,85 @@ macro(darwin_add_builtin_libraries)
OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
endif()
endforeach()
+ darwin_add_embedded_builtin_libraries()
endmacro()
+function(darwin_add_embedded_builtin_libraries)
+ set(MACHO_SYM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/macho_embedded)
+ if(CMAKE_CONFIGURATION_TYPES)
+ foreach(type ${CMAKE_CONFIGURATION_TYPES})
+ set(CMAKE_C_FLAGS_${type} -Oz)
+ set(CMAKE_CXX_FLAGS_${type} -Oz)
+ endforeach()
+ else()
+ set(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} -Oz)
+ endif()
+
+ set(CMAKE_C_FLAGS "-Wall -fomit-frame-pointer -ffreestanding")
+ set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
+ set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS})
+
+ set(SOFT_FLOAT_FLAG -mfloat-abi=soft)
+ set(HARD_FLOAT_FLAG -mfloat-abi=hard)
+
+ 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_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(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})
+ 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})
+ if(${arch} MATCHES "^arm")
+ set(DARWIN_macho_embedded_SYSROOT ${DARWIN_ios_SYSROOT})
+ endif()
+ darwin_add_builtin_library(clang_rt ${lib_suffix}
+ OS macho_embedded
+ ARCH ${arch}
+ SOURCES ${${arch}_filtered_sources}
+ CFLAGS -arch ${arch} ${${type}_FLAG} ${${float_type}_FLOAT_FLAG}
+ 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})
+ endforeach()
+ endforeach()
+endfunction()
Modified: compiler-rt/trunk/lib/builtins/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/CMakeLists.txt?rev=248850&r1=248849&r2=248850&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/builtins/CMakeLists.txt Tue Sep 29 18:13:45 2015
@@ -318,6 +318,11 @@ set(armv7_SOURCES ${arm_SOURCES})
set(armv7s_SOURCES ${arm_SOURCES})
set(arm64_SOURCES ${aarch64_SOURCES})
+# macho_embedded archs
+set(armv6m_SOURCES ${GENERIC_SOURCES})
+set(armv7m_SOURCES ${arm_SOURCES})
+set(armv7em_SOURCES ${arm_SOURCES})
+
add_custom_target(builtins)
if (APPLE)
Added: compiler-rt/trunk/lib/builtins/macho_embedded/arm.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/macho_embedded/arm.txt?rev=248850&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/macho_embedded/arm.txt (added)
+++ compiler-rt/trunk/lib/builtins/macho_embedded/arm.txt Tue Sep 29 18:13:45 2015
@@ -0,0 +1,18 @@
+aeabi_cdcmpeq
+aeabi_cdrcmple
+aeabi_cfcmpeq
+aeabi_cfrcmple
+aeabi_dcmpeq
+aeabi_dcmpge
+aeabi_dcmpgt
+aeabi_dcmple
+aeabi_dcmplt
+aeabi_drsub
+aeabi_fcmpeq
+aeabi_fcmpge
+aeabi_fcmpgt
+aeabi_fcmple
+aeabi_fcmplt
+aeabi_frsub
+aeabi_idivmod
+aeabi_uidivmod
Added: compiler-rt/trunk/lib/builtins/macho_embedded/common.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/macho_embedded/common.txt?rev=248850&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/macho_embedded/common.txt (added)
+++ compiler-rt/trunk/lib/builtins/macho_embedded/common.txt Tue Sep 29 18:13:45 2015
@@ -0,0 +1,93 @@
+absvdi2
+absvsi2
+addvdi3
+addvsi3
+ashldi3
+ashrdi3
+bswapdi2
+bswapsi2
+clzdi2
+clzsi2
+cmpdi2
+ctzdi2
+ctzsi2
+divdc3
+divdi3
+divsc3
+divmodsi4
+udivmodsi4
+do_global_dtors
+ffsdi2
+fixdfdi
+fixsfdi
+fixunsdfdi
+fixunsdfsi
+fixunssfdi
+fixunssfsi
+floatdidf
+floatdisf
+floatundidf
+floatundisf
+gcc_bcmp
+lshrdi3
+moddi3
+muldc3
+muldi3
+mulsc3
+mulvdi3
+mulvsi3
+negdi2
+negvdi2
+negvsi2
+paritydi2
+paritysi2
+popcountdi2
+popcountsi2
+powidf2
+powisf2
+subvdi3
+subvsi3
+ucmpdi2
+udiv_w_sdiv
+udivdi3
+udivmoddi4
+umoddi3
+adddf3
+addsf3
+cmpdf2
+cmpsf2
+div0
+divdf3
+divsf3
+divsi3
+extendsfdf2
+extendhfsf2
+ffssi2
+fixdfsi
+fixsfsi
+floatsidf
+floatsisf
+floatunsidf
+floatunsisf
+comparedf2
+comparesf2
+modsi3
+muldf3
+mulsf3
+negdf2
+negsf2
+subdf3
+subsf3
+truncdfhf2
+truncdfsf2
+truncsfhf2
+udivsi3
+umodsi3
+unorddf2
+unordsf2
+atomic_flag_clear
+atomic_flag_clear_explicit
+atomic_flag_test_and_set
+atomic_flag_test_and_set_explicit
+atomic_signal_fence
+atomic_thread_fence
Added: compiler-rt/trunk/lib/builtins/macho_embedded/i386.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/macho_embedded/i386.txt?rev=248850&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/macho_embedded/i386.txt (added)
+++ compiler-rt/trunk/lib/builtins/macho_embedded/i386.txt Tue Sep 29 18:13:45 2015
@@ -0,0 +1,7 @@
+i686.get_pc_thunk.eax
+i686.get_pc_thunk.ebp
+i686.get_pc_thunk.ebx
+i686.get_pc_thunk.ecx
+i686.get_pc_thunk.edi
+i686.get_pc_thunk.edx
+i686.get_pc_thunk.esi
Added: compiler-rt/trunk/lib/builtins/macho_embedded/thumb2.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/macho_embedded/thumb2.txt?rev=248850&view=auto
==============================================================================
--- compiler-rt/trunk/lib/builtins/macho_embedded/thumb2.txt (added)
+++ compiler-rt/trunk/lib/builtins/macho_embedded/thumb2.txt Tue Sep 29 18:13:45 2015
@@ -0,0 +1,24 @@
+switch16
+switch32
+switch8
+switchu8
+sync_fetch_and_add_4
+sync_fetch_and_sub_4
+sync_fetch_and_and_4
+sync_fetch_and_or_4
+sync_fetch_and_xor_4
+sync_fetch_and_nand_4
+sync_fetch_and_max_4
+sync_fetch_and_umax_4
+sync_fetch_and_min_4
+sync_fetch_and_umin_4
+sync_fetch_and_add_8
+sync_fetch_and_sub_8
+sync_fetch_and_and_8
+sync_fetch_and_or_8
+sync_fetch_and_xor_8
+sync_fetch_and_nand_8
+sync_fetch_and_max_8
+sync_fetch_and_umax_8
+sync_fetch_and_min_8
+sync_fetch_and_umin_8
More information about the llvm-commits
mailing list