diff options
Diffstat (limited to 'make/platform')
-rw-r--r-- | make/platform/clang_darwin.mk | 253 | ||||
-rw-r--r-- | make/platform/darwin_bni.mk | 95 | ||||
-rw-r--r-- | make/platform/darwin_fat.mk | 56 | ||||
-rw-r--r-- | make/platform/multi_arch.mk | 16 |
4 files changed, 420 insertions, 0 deletions
diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk new file mode 100644 index 000000000000..23cd3a42f86a --- /dev/null +++ b/make/platform/clang_darwin.mk @@ -0,0 +1,253 @@ +# These are the functions which clang needs when it is targetting a previous +# version of the OS. The issue is that the backend may use functions which were +# not present in the libgcc that shipped on the platform. In such cases, we link +# with a version of the library which contains private_extern definitions of all +# the extra functions which might be referenced. + +Description := Static runtime libraries for clang/Darwin. + +Configs := +UniversalArchs := + +# Configuration solely for providing access to an eprintf symbol, which may +# still be referenced from Darwin system headers. This symbol is only ever +# needed on i386. +Configs += eprintf +UniversalArchs.eprintf := i386 + +# Configuration for targetting 10.4. We need a few functions missing from +# libgcc_s.10.4.dylib. We only build x86 slices since clang doesn't really +# support targetting PowerPC. +Configs += 10.4 +UniversalArchs.10.4 := i386 x86_64 + +# Configuration for targetting armv6. We need a few additional functions which +# must be in the same linkage unit. +Configs += armv6 +UniversalArchs.armv6 := armv6 + +# Configuration for use with kernel/kexts. +Configs += cc_kext +UniversalArchs.cc_kext := armv6 i386 x86_64 + +# FIXME: Don't build an armv7 slice currently, they have the same functions. +# +#UniversalArchs.cc_kext := armv6 armv7 i386 x86_64 + +### + +CC := gcc + +# Forcibly strip off any -arch, as that totally breaks our universal support. +override CC := $(subst -arch ,-arch_,$(CC)) +override CC := $(patsubst -arch_%,,$(CC)) + +CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer + +FUNCTIONS.eprintf := eprintf +FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf +FUNCTIONS.armv6 := switch16 switch32 switch8 switchu8 \ + save_vfp_d8_d15_regs restore_vfp_d8_d15_regs + +CCKEXT_COMMON_FUNCTIONS := \ + absvdi2 \ + absvsi2 \ + addvdi3 \ + addvsi3 \ + ashldi3 \ + ashrdi3 \ + bswapdi2 \ + bswapsi2 \ + clear_cache \ + clzdi2 \ + clzsi2 \ + cmpdi2 \ + ctzdi2 \ + ctzsi2 \ + divdc3 \ + divdi3 \ + divsc3 \ + do_global_dtors \ + eprintf \ + 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 + +CCKEXT_ARM_FUNCTIONS := $(CCKEXT_COMMON_FUNCTONS) \ + adddf3 \ + addsf3 \ + 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 \ + cmpdf2 \ + cmpsf2 \ + div0 \ + divdf3 \ + divsf3 \ + divsi3 \ + extendsfdf2 \ + ffssi2 \ + fixdfsi \ + fixsfsi \ + floatsidf \ + floatsisf \ + floatunsidf \ + floatunsisf \ + gtdf2 \ + gtsf2 \ + ltdf2 \ + ltsf2 \ + modsi3 \ + muldf3 \ + mulsf3 \ + negdf2 \ + negsf2 \ + subdf3 \ + subsf3 \ + switch16 \ + switch32 \ + switch8 \ + switchu8 \ + truncdfsf2 \ + udivsi3 \ + umodsi3 \ + unorddf2 \ + unordsf2 + +FUNCTIONS.cc_kext.armv6 := $(CCKEXT_ARM_FUNCTIONS) +FUNCTIONS.cc_kext.armv7 := $(CCKEXT_ARM_FUNCTIONS) + +CCKEXT_X86_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ + divxc3 \ + fixunsxfdi \ + fixunsxfsi \ + fixxfdi \ + floatdixf \ + floatundixf \ + mulxc3 \ + powixf2 + +FUNCTIONS.cc_kext.i386 := $(CCKEXT_X86_FUNCTIONS) \ + ffssi2 \ + 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 + +FUNCTIONS.cc_kext.x86_64 := $(CCKEXT_X86_FUNCTIONS) \ + absvti2 \ + addvti3 \ + ashlti3 \ + ashrti3 \ + clzti2 \ + cmpti2 \ + ctzti2 \ + divti3 \ + ffsti2 \ + fixdfti \ + fixsfti \ + fixunsdfti \ + fixunssfti \ + fixunsxfti \ + fixxfti \ + floattidf \ + floattisf \ + floattixf \ + floatuntidf \ + floatuntisf \ + floatuntixf \ + lshrti3 \ + modti3 \ + multi3 \ + mulvti3 \ + negti2 \ + negvti2 \ + parityti2 \ + popcountti2 \ + subvti3 \ + ucmpti2 \ + udivmodti4 \ + udivti3 \ + umodti3 + +# FIXME: Currently, compiler-rt is missing implementations for a number of the +# functions that need to go into libcc_kext.a. Filter them out for now. +CCKEXT_MISSING_FUNCTIONS := \ + adddf3 addsf3 cmpdf2 cmpsf2 div0 divdf3 divsf3 \ + extendsfdf2 ffssi2 fixdfsi fixsfsi floatsidf floatsisf \ + floatunsidf floatunsisf gtdf2 gtsf2 ltdf2 ltsf2 \ + muldf3 mulsf3 negdf2 negsf2 subdf3 subsf3 \ + truncdfsf2 udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \ + bswapsi2 \ + gcc_bcmp \ + do_global_dtors \ + 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 \ + 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 + +FUNCTIONS.cc_kext.armv6 := \ + $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.armv6)) +FUNCTIONS.cc_kext.armv7 := \ + $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.armv7)) +FUNCTIONS.cc_kext.i386 := \ + $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.i386)) +FUNCTIONS.cc_kext.x86_64 := \ + $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.x86_64)) + +KERNEL_USE.cc_kext := 1 + +VISIBILITY_HIDDEN := 1 diff --git a/make/platform/darwin_bni.mk b/make/platform/darwin_bni.mk new file mode 100644 index 000000000000..ec859f3b5d6e --- /dev/null +++ b/make/platform/darwin_bni.mk @@ -0,0 +1,95 @@ + +Description := Target for Darwin using an Apple-style build. + +Configs := Debug Release Profile Static + +# We override this with RC_ARCHS because B&I may want to build on an ARCH we +# haven't explicitly defined support for. If all goes well, this will just work +# and the resulting lib will just have generic versions for anything unknown. +UniversalArchs := $(RC_ARCHS) + +ifeq (,$(SDKROOT)) +else + CC.Release := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc + CC.Static := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc +endif + + +CFLAGS := -Wall -Os -fomit-frame-pointer -g +CFLAGS.Static := $(CFLAGS) -static + +VISIBILITY_HIDDEN := 0 +VISIBILITY_HIDDEN.Static := 1 + + +FUNCTIONS := absvdi2 absvsi2 addvdi3 addvsi3 ashldi3 ashrdi3 \ + clzdi2 clzsi2 cmpdi2 ctzdi2 ctzsi2 \ + divdc3 divdi3 divsc3 ffsdi2 \ + fixdfdi fixsfdi fixunsdfdi fixunsdfsi fixunssfdi \ + fixunssfsi floatdidf floatdisf floatundidf floatundisf \ + gcc_personality_v0 lshrdi3 moddi3 muldc3 muldi3 \ + mulsc3 mulvdi3 mulvsi3 negdi2 negvdi2 negvsi2 \ + paritydi2 paritysi2 popcountdi2 popcountsi2 powidf2 \ + powisf2 subvdi3 subvsi3 ucmpdi2 udivdi3 \ + udivmoddi4 umoddi3 apple_versioning eprintf + +FUNCTIONS.i386 := $(FUNCTIONS) \ + divxc3 fixunsxfdi fixunsxfsi fixxfdi floatdixf \ + floatundixf mulxc3 powixf2 clear_cache \ + enable_execute_stack +FUNCTIONS.ppc := $(FUNCTIONS) \ + divtc3 fixtfdi fixunstfdi floatditf floatunditf \ + gcc_qadd gcc_qdiv gcc_qmul gcc_qsub multc3 \ + powitf2 restFP saveFP trampoline_setup \ + clear_cache enable_execute_stack +FUNCTIONS.x86_64 := $(FUNCTIONS) \ + absvti2 addvti3 ashlti3 ashrti3 clzti2 cmpti2 \ + ctzti2 divti3 divxc3 ffsti2 fixdfti fixsfti \ + fixunsdfti fixunssfti fixunsxfdi fixunsxfsi \ + fixunsxfti fixxfdi fixxfti floatdixf floattidf \ + floattisf floattixf floatundixf floatuntidf \ + floatuntisf floatuntixf lshrti3 modti3 multi3 \ + mulvti3 mulxc3 negti2 negvti2 parityti2 \ + popcountti2 powixf2 subvti3 ucmpti2 udivmodti4 \ + udivti3 umodti3 clear_cache enable_execute_stack +FUNCTIONS.armv5 := $(FUNCTIONS) \ + adddf3 addsf3 bswapdi2 bswapsi2 \ + comparedf2 comparesf2 extendsfdf2 \ + divdf3 divsf3 \ + fixdfsi fixsfsi fixunsdfsi fixunssfsi \ + floatsidf floatsisf floatunsidf floatunsisf \ + muldf3 mulsf3 \ + negdf2 negsf2 \ + truncdfsf2 \ + modsi3 umodsi3 udivsi3 divsi3 \ + switch8 switchu8 switch16 switch32 \ + sync_synchronize + +FUNCTIONS.armv6 := $(FUNCTIONS) \ + comparedf2 comparesf2 \ + adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ + divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ + fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ + floatsidfvfp floatsisfvfp floatunssidfvfp floatunssisfvfp \ + gedf2vfp gesf2vfp gtdf2vfp gtsf2vfp \ + ledf2vfp lesf2vfp ltdf2vfp ltsf2vfp \ + muldf3vfp mulsf3vfp \ + nedf2vfp nesf2vfp \ + subdf3vfp subsf3vfp truncdfsf2vfp unorddf2vfp unordsf2vfp \ + modsi3 umodsi3 udivsi3 divsi3 \ + switch8 switchu8 switch16 switch32 \ + restore_vfp_d8_d15_regs save_vfp_d8_d15_regs \ + sync_synchronize +FUNCTIONS.armv7 := $(FUNCTIONS) \ + comparedf2 comparesf2 \ + adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ + divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ + fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ + floatsidfvfp floatsisfvfp floatunssidfvfp floatunssisfvfp \ + gedf2vfp gesf2vfp gtdf2vfp gtsf2vfp \ + ledf2vfp lesf2vfp ltdf2vfp ltsf2vfp \ + muldf3vfp mulsf3vfp \ + nedf2vfp nesf2vfp \ + subdf3vfp subsf3vfp truncdfsf2vfp unorddf2vfp unordsf2vfp \ + modsi3 umodsi3 udivsi3 divsi3 + diff --git a/make/platform/darwin_fat.mk b/make/platform/darwin_fat.mk new file mode 100644 index 000000000000..30e57a198e2e --- /dev/null +++ b/make/platform/darwin_fat.mk @@ -0,0 +1,56 @@ +# Configurations to build +# +# This section must define: +# Description - A description of this target. +# Configs - The names of each configuration to build; this is used to build +# multiple libraries inside a single configuration file (for +# example, Debug and Release builds, or builds with and without +# software floating point). +# +# This section must define one of: +# UniveralArchs - A list of architectures to build for, when using universal build +# support (e.g., on Darwin). This should only be used to build fat +# libraries, simply building multiple libraries for different +# architectures should do so using distinct configs, with the +# appropriate choices for CC and CFLAGS. +# +# Arch - The target architecture; this must match the compiler-rt name for the +# architecture and is used to find the appropriate function +# implementations. +# +# When not universal builds, this section may define: +# Arch.<Config Name> - Set the target architecture on a per-config basis. + +Description := Target for building universal libraries for Darwin. + +Configs := Debug Release Profile +UniversalArchs := i386 ppc x86_64 + +# Platform Options +# +# This section may override any of the variables in make/options.mk, using: +# <Option Name> := ... option value ... +# +# See make/options.mk for the available options and their meanings. Options can +# be override on a per-config, per-arch, or per-config-and-arch basis using: +# <Option Name>.<Config Name> := ... +# <Option Name>.<Arch Name> := ... +# <Option Name>.<Config Name>.<Arch Name> := ... + +CC := gcc + +CFLAGS := -Wall -Werror +CFLAGS.Debug := $(CFLAGS) -g +CFLAGS.Release := $(CFLAGS) -O3 -fomit-frame-pointer +CFLAGS.Profile := $(CFLAGS) -pg -g + +FUNCTIONS.i386 := $(CommonFunctions) $(ArchFunctions.i386) +FUNCTIONS.ppc := $(CommonFunctions) $(ArchFunctions.ppc) +FUNCTIONS.x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) +FUNCTIONS.armv5 := $(CommonFunctions) $(ArchFunctions.armv5) +FUNCTIONS.armv6 := $(CommonFunctions) $(ArchFunctions.armv6) +FUNCTIONS.armv7 := $(CommonFunctions) $(ArchFunctions.armv7) + +OPTIMIZED.Debug := 0 + +VISIBILITY_HIDDEN := 1 diff --git a/make/platform/multi_arch.mk b/make/platform/multi_arch.mk new file mode 100644 index 000000000000..eebc7b2f80d7 --- /dev/null +++ b/make/platform/multi_arch.mk @@ -0,0 +1,16 @@ +Description := Example configuration for build two libraries for separate \ +architectures. + +Configs := m32 m64 +Arch := i386 +Arch.m64 := x86_64 + +CC := gcc +CC.m32 := clang + +CFLAGS := -Wall -Werror +CFLAGS.m32 := $(CFLAGS) -m32 -O3 +CFLAGS.m64 := $(CFLAGS) -m64 -O3 + +FUNCTIONS := moddi3 floatundixf udivdi3 +FUNCTIONS.m64 := $(FUNCTIONS) lshrdi3 |