diff options
author | Ed Schouten <ed@FreeBSD.org> | 2011-12-31 14:55:23 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2011-12-31 14:55:23 +0000 |
commit | 219fb0488994a289f1087f7b3da18789e068da12 (patch) | |
tree | d59ced7e19afaab87432b7610faefff3080e8d2a /make/platform | |
parent | b0a04aaa595ba76468e521f12727a872d144d6d0 (diff) | |
download | src-219fb0488994a289f1087f7b3da18789e068da12.tar.gz src-219fb0488994a289f1087f7b3da18789e068da12.zip |
Import compiler-rt r147390.vendor/compiler-rt/compiler-rt-r147390
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=229109
svn path=/vendor/compiler-rt/compiler-rt-r147390/; revision=229110; tag=vendor/compiler-rt/compiler-rt-r147390
Diffstat (limited to 'make/platform')
-rw-r--r-- | make/platform/clang_darwin.mk | 129 | ||||
-rw-r--r-- | make/platform/clang_darwin_test_input.c | 6 | ||||
-rw-r--r-- | make/platform/clang_linux.mk | 82 | ||||
-rw-r--r-- | make/platform/darwin_bni.mk | 43 | ||||
-rw-r--r-- | make/platform/darwin_fat.mk | 4 | ||||
-rw-r--r-- | make/platform/multi_arch.mk | 3 |
6 files changed, 227 insertions, 40 deletions
diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk index 6eb10c82267b..bb8bf78a0873 100644 --- a/make/platform/clang_darwin.mk +++ b/make/platform/clang_darwin.mk @@ -12,7 +12,9 @@ CheckArches = \ $(shell \ result=""; \ for arch in $(1); do \ - if $(CC) -arch $$arch -dumpversion > /dev/null; then \ + if $(CC) -arch $$arch -c \ + $(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \ + -o /dev/null > /dev/null 2> /dev/null; then \ result="$$result$$arch "; \ fi; \ done; \ @@ -20,6 +22,8 @@ CheckArches = \ ### +CC := clang + Configs := UniversalArchs := @@ -41,13 +45,41 @@ UniversalArchs.10.4 := $(call CheckArches,i386 x86_64) Configs += ios UniversalArchs.ios := $(call CheckArches,i386 x86_64 armv6 armv7) +# Configuration for targetting OSX. These functions may not be in libSystem +# so we should provide our own. +Configs += osx +UniversalArchs.osx := $(call CheckArches,i386 x86_64) + # Configuration for use with kernel/kexts. Configs += cc_kext UniversalArchs.cc_kext := $(call CheckArches,armv6 armv7 i386 x86_64) -### +# Configurations which define the profiling support functions. +Configs += profile_osx +UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64) +Configs += profile_ios +UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 armv6 armv7) + +# Configurations which define the ASAN support functions. +# +# Note that ASAN doesn't appear to currently support i386. +Configs += asan_osx +UniversalArchs.asan_osx := $(call CheckArches,i386 x86_64) -CC := gcc +# If RC_SUPPORTED_ARCHS is defined, treat it as a list of the architectures we +# are intended to support and limit what we try to build to that. +# +# We make sure to remove empty configs if we end up dropping all the requested +# archs for a particular config. +ifneq ($(RC_SUPPORTED_ARCHS),) +$(foreach config,$(Configs),\ + $(call Set,UniversalArchs.$(config),\ + $(filter $(RC_SUPPORTED_ARCHS),$(UniversalArchs.$(config))))\ + $(if $(UniversalArchs.$(config)),,\ + $(call Set,Configs,$(filter-out $(config),$(Configs))))) +endif + +### # Forcibly strip off any -arch, as that totally breaks our universal support. override CC := $(subst -arch ,-arch_,$(CC)) @@ -59,29 +91,41 @@ CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer # never depend on the environmental overrides. We simply set them to minimum # supported deployment target -- nothing in the compiler-rt libraries should # actually depend on the deployment target. -X86_DEPLOYMENT_ARGS := -mmacosx-version-min=10.4 -ARM_DEPLOYMENT_ARGS := -miphoneos-version-min=1.0 +OSX_DEPLOYMENT_ARGS := -mmacosx-version-min=10.4 +IOS_DEPLOYMENT_ARGS := -miphoneos-version-min=1.0 +IOSSIM_DEPLOYMENT_ARGS := -miphoneos-version-min=1.0 -# If an explicit ARM_SDK build variable is set, use that as the isysroot. -ifneq ($(ARM_SDK),) -ARM_DEPLOYMENT_ARGS += -isysroot $(ARM_SDK) -endif +# Use our stub SDK as the sysroot to support more portable building. +OSX_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin +IOS_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin +IOSSIM_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin + +CFLAGS.eprintf := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +CFLAGS.10.4 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +# FIXME: We can't build ASAN with our stub SDK yet. +CFLAGS.asan_osx := $(CFLAGS) -mmacosx-version-min=10.5 -CFLAGS.eprintf := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) -CFLAGS.10.4 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) -CFLAGS.ios.i386 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) -CFLAGS.ios.x86_64 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) -CFLAGS.ios.armv6 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) -CFLAGS.ios.armv7 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) -CFLAGS.cc_kext.i386 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) -CFLAGS.cc_kext.x86_64 := $(CFLAGS) $(X86_DEPLOYMENT_ARGS) -CFLAGS.cc_kext.armv6 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) -mthumb -CFLAGS.cc_kext.armv7 := $(CFLAGS) $(ARM_DEPLOYMENT_ARGS) -mthumb +CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) +CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) +CFLAGS.ios.armv6 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) +CFLAGS.ios.armv7 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) +CFLAGS.osx.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +CFLAGS.osx.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +CFLAGS.cc_kext.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +CFLAGS.cc_kext.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +CFLAGS.cc_kext.armv6 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) -mthumb +CFLAGS.cc_kext.armv7 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) +CFLAGS.profile_osx.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +CFLAGS.profile_osx.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) +CFLAGS.profile_ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) +CFLAGS.profile_ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) +CFLAGS.profile_ios.armv6 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) +CFLAGS.profile_ios.armv7 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) FUNCTIONS.eprintf := eprintf FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf -FUNCTIONS.ios := divmodsi4 udivmodsi4 +FUNCTIONS.ios := divmodsi4 udivmodsi4 mulosi4 mulodi4 muloti4 # On x86, the divmod functions reference divsi. FUNCTIONS.ios.i386 := $(FUNCTIONS.ios) \ divsi3 udivsi3 @@ -92,6 +136,13 @@ FUNCTIONS.ios.armv6 := $(FUNCTIONS.ios) \ switch16 switch32 switch8 switchu8 \ save_vfp_d8_d15_regs restore_vfp_d8_d15_regs +FUNCTIONS.osx := mulosi4 mulodi4 muloti4 + +FUNCTIONS.profile_osx := GCDAProfiling +FUNCTIONS.profile_ios := GCDAProfiling + +FUNCTIONS.asan_osx := $(AsanFunctions) + CCKEXT_COMMON_FUNCTIONS := \ absvdi2 \ absvsi2 \ @@ -203,8 +254,42 @@ CCKEXT_ARM_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ unorddf2 \ unordsf2 -FUNCTIONS.cc_kext.armv6 := $(CCKEXT_ARM_FUNCTIONS) -FUNCTIONS.cc_kext.armv7 := $(CCKEXT_ARM_FUNCTIONS) +CCKEXT_ARMVFP_FUNCTIONS := $(CCKEXT_ARM_FUNCTIONS) \ + adddf3vfp \ + addsf3vfp \ + 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 + +FUNCTIONS.cc_kext.armv6 := $(CCKEXT_ARMVFP_FUNCTIONS) +FUNCTIONS.cc_kext.armv7 := $(CCKEXT_ARMVFP_FUNCTIONS) CCKEXT_X86_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ divxc3 \ diff --git a/make/platform/clang_darwin_test_input.c b/make/platform/clang_darwin_test_input.c new file mode 100644 index 000000000000..b7074b852d88 --- /dev/null +++ b/make/platform/clang_darwin_test_input.c @@ -0,0 +1,6 @@ +/* Include the headers we use in int_lib.h, to verify that they work. */ + +#include <limits.h> +#include <stdint.h> +#include <stdlib.h> +#include <stdio.h> diff --git a/make/platform/clang_linux.mk b/make/platform/clang_linux.mk new file mode 100644 index 000000000000..b3a77593a1ef --- /dev/null +++ b/make/platform/clang_linux.mk @@ -0,0 +1,82 @@ +Description := Static runtime libraries for clang/Linux. + +### + +CC := clang +Arch := unknown +Configs := + +# We don't currently have any general purpose way to target architectures other +# than the compiler defaults (because there is no generalized way to invoke +# cross compilers). For now, we just find the target archicture of the compiler +# and only define configurations we know that compiler can generate. +CompilerTargetTriple := $(shell \ + $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2) +ifneq ($(DEBUGMAKE),) +ifeq ($(CompilerTargetTriple),) +$(error "unable to infer compiler target triple for $(CC)") +endif +endif + +CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple))) + +# Only define configs if we detected a linux target. +ifneq ($(findstring -linux-,$(CompilerTargetTriple)),) + +# Configurations which just include all the runtime functions. +ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true) +Configs += full-i386 full-x86_64 +Arch.full-i386 := i386 +Arch.full-x86_64 := x86_64 +endif + +# Configuration for profile runtime. +ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true) +Configs += profile-i386 profile-x86_64 +Arch.profile-i386 := i386 +Arch.profile-x86_64 := x86_64 +endif + +# Configuration for ASAN runtime. +ifeq ($(CompilerTargetArch),i386) +Configs += asan-i386 +Arch.asan-i386 := i386 +endif +ifeq ($(CompilerTargetArch),x86_64) +Configs += asan-x86_64 +Arch.asan-x86_64 := x86_64 +endif + +endif + +### + +CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer + +CFLAGS.full-i386 := $(CFLAGS) -m32 +CFLAGS.full-x86_64 := $(CFLAGS) -m64 +CFLAGS.profile-i386 := $(CFLAGS) -m32 +CFLAGS.profile-x86_64 := $(CFLAGS) -m64 +CFLAGS.asan-i386 := $(CFLAGS) -m32 +CFLAGS.asan-x86_64 := $(CFLAGS) -m64 + +# Use our stub SDK as the sysroot to support more portable building. For now we +# just do this for the non-ASAN modules, because the stub SDK doesn't have +# enough support to build ASAN. +CFLAGS.full-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux +CFLAGS.full-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux +CFLAGS.profile-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux +CFLAGS.profile-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux + +FUNCTIONS.full-i386 := $(CommonFunctions) $(ArchFunctions.i386) +FUNCTIONS.full-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) +FUNCTIONS.profile-i386 := GCDAProfiling +FUNCTIONS.profile-x86_64 := GCDAProfiling +FUNCTIONS.asan-i386 := $(AsanFunctions) +FUNCTIONS.asan-x86_64 := $(AsanFunctions) + +# Always use optimized variants. +OPTIMIZED := 1 + +# We don't need to use visibility hidden on Linux. +VISIBILITY_HIDDEN := 0 diff --git a/make/platform/darwin_bni.mk b/make/platform/darwin_bni.mk index 14a1c197ec45..477e072de0a0 100644 --- a/make/platform/darwin_bni.mk +++ b/make/platform/darwin_bni.mk @@ -1,24 +1,37 @@ Description := Target for Darwin using an Apple-style build. -Configs := Debug Release Profile Static +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)) - CC.Release := $(CC) - CC.Static := $(CC) +ifneq (,$(SDKROOT)) + override CC := $(shell xcrun -sdk $(SDKROOT) -find clang) + AR := $(shell xcrun -sdk $(SDKROOT) -find ar) + RANLIB := $(shell xcrun -sdk $(SDKROOT) -find ranlib) + STRIP := $(shell xcrun -sdk $(SDKROOT) -find strip) + LIPO := $(shell xcrun -sdk $(SDKROOT) -find lipo) +endif + +ifneq ($(IPHONEOS_DEPLOYMENT_TARGET),) + DEPLOYMENT_FLAGS := -miphoneos-version-min=$(IPHONEOS_DEPLOYMENT_TARGET) else - CC.Release := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc - CC.Static := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc + ifneq ($(MACOSX_DEPLOYMENT_TARGET),) + DEPLOYMENT_FLAGS := -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) + endif endif +ifneq (,$(SDKROOT)) + DEPLOYMENT_FLAGS += -isysroot $(SDKROOT) +endif -CFLAGS := -Wall -Os -fomit-frame-pointer -g -CFLAGS.Static := $(CFLAGS) -static +CFLAGS := -Wall -Os -fomit-frame-pointer -g $(DEPLOYMENT_FLAGS) +CFLAGS.Static := $(CFLAGS) -static +DYLIB_FLAGS := $(DEPLOYMENT_FLAGS) \ + -Xarch_arm -Wl,-alias_list,$(SRCROOT)/lib/arm/softfloat-alias.list VISIBILITY_HIDDEN := 0 VISIBILITY_HIDDEN.Static := 1 @@ -29,8 +42,8 @@ FUNCTIONS := absvdi2 absvsi2 addvdi3 addvsi3 ashldi3 ashrdi3 \ 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 \ + gcc_personality_v0 lshrdi3 moddi3 muldc3 muldi3 mulosi4 \ + mulodi4 muloti4 mulsc3 mulvdi3 mulvsi3 negdi2 negvdi2 negvsi2 \ paritydi2 paritysi2 popcountdi2 popcountsi2 powidf2 \ powisf2 subvdi3 subvsi3 ucmpdi2 udivdi3 \ udivmoddi4 umoddi3 apple_versioning eprintf @@ -51,9 +64,12 @@ FUNCTIONS.x86_64 := $(FUNCTIONS) \ fixunsxfti fixxfdi fixxfti floatdixf floattidf \ floattisf floattixf floatundixf floatuntidf \ floatuntisf floatuntixf lshrti3 modti3 multi3 \ - mulvti3 mulxc3 negti2 negvti2 parityti2 \ + muloti4 mulvti3 mulxc3 negti2 negvti2 parityti2 \ popcountti2 powixf2 subvti3 ucmpti2 udivmodti4 \ udivti3 umodti3 clear_cache enable_execute_stack + +FUNCTIONS.armv4t := $(FUNCTIONS) + FUNCTIONS.armv5 := $(FUNCTIONS) \ adddf3 addsf3 bswapdi2 bswapsi2 \ comparedf2 comparesf2 extendsfdf2 \ @@ -65,7 +81,7 @@ FUNCTIONS.armv5 := $(FUNCTIONS) \ truncdfsf2 \ modsi3 umodsi3 udivsi3 divsi3 udivmodsi4 divmodsi4 \ switch8 switchu8 switch16 switch32 \ - sync_synchronize + sync_synchronize FUNCTIONS.armv6 := $(FUNCTIONS) \ comparedf2 comparesf2 \ @@ -81,7 +97,7 @@ FUNCTIONS.armv6 := $(FUNCTIONS) \ modsi3 umodsi3 udivsi3 divsi3 udivmodsi4 divmodsi4 \ switch8 switchu8 switch16 switch32 \ restore_vfp_d8_d15_regs save_vfp_d8_d15_regs \ - sync_synchronize + sync_synchronize FUNCTIONS.armv7 := $(FUNCTIONS) \ comparedf2 comparesf2 \ @@ -95,4 +111,3 @@ FUNCTIONS.armv7 := $(FUNCTIONS) \ nedf2vfp nesf2vfp \ subdf3vfp subsf3vfp truncdfsf2vfp unorddf2vfp unordsf2vfp \ modsi3 umodsi3 udivsi3 divsi3 udivmodsi4 divmodsi4 - diff --git a/make/platform/darwin_fat.mk b/make/platform/darwin_fat.mk index 30e57a198e2e..54936a39ffb9 100644 --- a/make/platform/darwin_fat.mk +++ b/make/platform/darwin_fat.mk @@ -24,7 +24,7 @@ Description := Target for building universal libraries for Darwin. Configs := Debug Release Profile -UniversalArchs := i386 ppc x86_64 +UniversalArchs := i386 x86_64 # Platform Options # @@ -37,7 +37,7 @@ UniversalArchs := i386 ppc x86_64 # <Option Name>.<Arch Name> := ... # <Option Name>.<Config Name>.<Arch Name> := ... -CC := gcc +CC := clang CFLAGS := -Wall -Werror CFLAGS.Debug := $(CFLAGS) -g diff --git a/make/platform/multi_arch.mk b/make/platform/multi_arch.mk index eebc7b2f80d7..fe6ac4be0eb4 100644 --- a/make/platform/multi_arch.mk +++ b/make/platform/multi_arch.mk @@ -5,8 +5,7 @@ Configs := m32 m64 Arch := i386 Arch.m64 := x86_64 -CC := gcc -CC.m32 := clang +CC := clang CFLAGS := -Wall -Werror CFLAGS.m32 := $(CFLAGS) -m32 -O3 |