aboutsummaryrefslogtreecommitdiff
path: root/make/platform
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-06 22:49:13 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-06 22:49:13 +0000
commit8ef50bf3d1c287b5013c3168de77a462dfce3495 (patch)
tree3467f3372c1195b1546172d89af2205a50b1866d /make/platform
parent11023dc647fd8f41418da90d59db138400d0f334 (diff)
downloadsrc-8ef50bf3d1c287b5013c3168de77a462dfce3495.tar.gz
src-8ef50bf3d1c287b5013c3168de77a462dfce3495.zip
Import compiler-rt release_34 branch r197381.vendor/compiler-rt/compiler-rt-r197381
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=274201 svn path=/vendor/compiler-rt/compiler-rt-r197381/; revision=274202; tag=vendor/compiler-rt/compiler-rt-r197381
Diffstat (limited to 'make/platform')
-rw-r--r--make/platform/clang_darwin.mk49
-rw-r--r--make/platform/clang_darwin_embedded.mk250
-rw-r--r--make/platform/clang_linux.mk20
-rw-r--r--make/platform/darwin_bni.mk12
4 files changed, 313 insertions, 18 deletions
diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk
index cb61744e5b7e..ddb702944874 100644
--- a/make/platform/clang_darwin.mk
+++ b/make/platform/clang_darwin.mk
@@ -25,9 +25,24 @@ CheckArches = \
done; \
echo $$result)
+XCRun = \
+ $(shell \
+ result=`xcrun -find $(1) 2> /dev/null`; \
+ if [ "$$?" != "0" ]; then result=$(1); fi; \
+ echo $$result)
+XCRunSdkPath = \
+ $(shell \
+ result=`xcrun --sdk $(1) --show-sdk-path 2> /dev/null`; \
+ if [ "$$?" != "0" ]; then result=""; fi; \
+ echo $$result)
###
-CC := clang
+CC := $(call XCRun,clang)
+AR := $(call XCRun,ar)
+RANLIB := $(call XCRun,ranlib)
+STRIP := $(call XCRun,strip)
+LIPO := $(call XCRun,lipo)
+DSYMUTIL := $(call XCRun,dsymutil)
Configs :=
UniversalArchs :=
@@ -73,6 +88,12 @@ UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 armv7,profile_ios)
Configs += asan_osx_dynamic
UniversalArchs.asan_osx_dynamic := $(call CheckArches,i386 x86_64,asan_osx_dynamic)
+IOSSIM_SDK_PATH := $(call XCRunSdkPath,iphonesimulator)
+ifneq ($(IOSSIM_SDK_PATH),)
+Configs += asan_iossim_dynamic
+UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64,asan_iossim_dynamic)
+endif
+
Configs += ubsan_osx
UniversalArchs.ubsan_osx := $(call CheckArches,i386 x86_64,ubsan_osx)
@@ -127,12 +148,20 @@ 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_dynamic := \
- $(CFLAGS) -mmacosx-version-min=10.5 -fno-builtin \
+ $(CFLAGS) -mmacosx-version-min=10.6 -fno-builtin \
-gline-tables-only \
-DMAC_INTERPOSE_FUNCTIONS=1 \
-DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
-CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.5 -fno-builtin
+CFLAGS.asan_iossim_dynamic := \
+ $(CFLAGS) -mios-simulator-version-min=7.0 \
+ -isysroot $(IOSSIM_SDK_PATH) \
+ -fno-builtin \
+ -gline-tables-only \
+ -DMAC_INTERPOSE_FUNCTIONS=1 \
+ -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
+
+CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.6 -fno-builtin
CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
@@ -163,7 +192,15 @@ CFLAGS.profile_ios.armv7s := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
# Configure the asan_osx_dynamic library to be built shared.
SHARED_LIBRARY.asan_osx_dynamic := 1
-LDFLAGS.asan_osx_dynamic := -framework Foundation -lstdc++ -undefined dynamic_lookup
+LDFLAGS.asan_osx_dynamic := -lstdc++ -undefined dynamic_lookup
+
+# Configure the asan_iossim_dynamic library to be built shared.
+SHARED_LIBRARY.asan_iossim_dynamic := 1
+# configure+make uses Clang, so we're using isysroot instead of --sysroot
+# or -Wl,-syslibroot.
+LDFLAGS.asan_iossim_dynamic := -undefined dynamic_lookup \
+ -Wl,-ios_simulator_version_min,7.0.0 \
+ -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK_PATH)
FUNCTIONS.eprintf := eprintf
FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf
@@ -184,6 +221,10 @@ FUNCTIONS.asan_osx_dynamic := $(AsanFunctions) $(InterceptionFunctions) \
$(SanitizerCommonFunctions) \
$(AsanDynamicFunctions)
+FUNCTIONS.asan_iossim_dynamic := $(AsanFunctions) $(InterceptionFunctions) \
+ $(SanitizerCommonFunctions) \
+ $(AsanDynamicFunctions)
+
FUNCTIONS.ubsan_osx := $(UbsanFunctions) $(UbsanCXXFunctions) \
$(SanitizerCommonFunctions)
diff --git a/make/platform/clang_darwin_embedded.mk b/make/platform/clang_darwin_embedded.mk
new file mode 100644
index 000000000000..3cea2e45c8ab
--- /dev/null
+++ b/make/platform/clang_darwin_embedded.mk
@@ -0,0 +1,250 @@
+# 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 embedded clang/Darwin
+
+XCRun = \
+ $(shell \
+ result=`xcrun -find $(1) 2> /dev/null`; \
+ if [ "$$?" != "0" ]; then result=$(1); fi; \
+ echo $$result)
+
+###
+
+CC := $(call XCRun,clang)
+AR := $(call XCRun,ar)
+RANLIB := $(call XCRun,ranlib)
+STRIP := $(call XCRun,strip)
+LIPO := $(call XCRun,lipo)
+DSYMUTIL := $(call XCRun,dsymutil)
+
+Configs :=
+UniversalArchs :=
+
+# Soft-float version of the runtime. No floating-point instructions will be used
+# and the ABI (out of necessity) passes floating values in normal registers:
+# non-VFP variant of the AAPCS.
+Configs += soft_static
+UniversalArchs.soft_static := armv6m armv7m armv7em armv7
+
+# Hard-float version of the runtime. On ARM VFP instructions and registers are
+# allowed, and floating point values get passed in them. VFP variant of the
+# AAPCS.
+Configs += hard_static
+UniversalArchs.hard_static := armv7em armv7 i386 x86_64
+
+Configs += soft_pic
+UniversalArchs.soft_pic := armv6m armv7m armv7em armv7
+
+Configs += hard_pic
+UniversalArchs.hard_pic := armv7em armv7 i386 x86_64
+
+CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding
+
+PIC_CFLAGS := -fPIC
+STATIC_CFLAGS := -static
+
+CFLAGS_SOFT := -mfloat-abi=soft
+CFLAGS_HARD := -mfloat-abi=hard
+
+CFLAGS_ARMV7 := -target thumbv7-apple-darwin-eabi
+CFLAGS_I386 := -march=pentium
+
+CFLAGS.soft_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_SOFT)
+CFLAGS.hard_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_HARD)
+CFLAGS.soft_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_SOFT)
+CFLAGS.hard_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_HARD)
+
+CFLAGS.soft_static.armv7 := $(CFLAGS.soft_static) $(CFLAGS_ARMV7)
+CFLAGS.hard_static.armv7 := $(CFLAGS.hard_static) $(CFLAGS_ARMV7)
+CFLAGS.soft_pic.armv7 := $(CFLAGS.soft_pic) $(CFLAGS_ARMV7)
+CFLAGS.hard_pic.armv7 := $(CFLAGS.hard_pic) $(CFLAGS_ARMV7)
+
+# x86 platforms ignore -mfloat-abi options and complain about doing so. Despite
+# this they're hard-float.
+CFLAGS.hard_static.i386 := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_I386)
+CFLAGS.hard_pic.i386 := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_I386)
+CFLAGS.hard_static.x86_64 := $(CFLAGS) $(STATIC_CFLAGS)
+CFLAGS.hard_pic.x86_64 := $(CFLAGS) $(PIC_CFLAGS)
+
+# Functions not wanted:
+# + eprintf is obsolete anyway
+# + *vfp: designed for Thumb1 CPUs with VFPv2
+
+COMMON_FUNCTIONS := \
+ 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 \
+ ffssi2 \
+ fixdfsi \
+ fixsfsi \
+ floatsidf \
+ floatsisf \
+ floatunsidf \
+ floatunsisf \
+ comparedf2 \
+ comparesf2 \
+ modsi3 \
+ muldf3 \
+ mulsf3 \
+ negdf2 \
+ negsf2 \
+ subdf3 \
+ subsf3 \
+ truncdfsf2 \
+ udivsi3 \
+ umodsi3 \
+ unorddf2 \
+ unordsf2
+
+ARM_FUNCTIONS := \
+ 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 \
+
+# ARM Assembly implementation which requires Thumb2 (i.e. won't work on v6M).
+THUMB2_FUNCTIONS := \
+ switch16 \
+ switch32 \
+ switch8 \
+ switchu8 \
+
+I386_FUNCTIONS := \
+ 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
+
+# FIXME: Currently, compiler-rt is missing implementations for a number of the
+# functions. Filter them out for now.
+MISSING_FUNCTIONS := \
+ cmpdf2 cmpsf2 div0 \
+ ffssi2 \
+ 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_ARMV6M := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS)
+FUNCTIONS_ARM_ALL := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS) $(THUMB2_FUNCTIONS)
+FUNCTIONS_I386 := $(COMMON_FUNCTIONS) $(I386_FUNCTIONS)
+FUNCTIONS_X86_64 := $(COMMON_FUNCTIONS)
+
+FUNCTIONS_ARMV6M := \
+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARMV6M))
+FUNCTIONS_ARM_ALL := \
+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARM_ALL))
+FUNCTIONS_I386 := \
+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_I386))
+FUNCTIONS_X86_64 := \
+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_X86_64))
+
+FUNCTIONS.soft_static.armv6m := $(FUNCTIONS_ARMV6M)
+FUNCTIONS.soft_pic.armv6m := $(FUNCTIONS_ARMV6M)
+
+FUNCTIONS.soft_static.armv7m := $(FUNCTIONS_ARM_ALL)
+FUNCTIONS.soft_pic.armv7m := $(FUNCTIONS_ARM_ALL)
+
+FUNCTIONS.soft_static.armv7em := $(FUNCTIONS_ARM_ALL)
+FUNCTIONS.hard_static.armv7em := $(FUNCTIONS_ARM_ALL)
+FUNCTIONS.soft_pic.armv7em := $(FUNCTIONS_ARM_ALL)
+FUNCTIONS.hard_pic.armv7em := $(FUNCTIONS_ARM_ALL)
+
+FUNCTIONS.soft_static.armv7 := $(FUNCTIONS_ARM_ALL)
+FUNCTIONS.hard_static.armv7 := $(FUNCTIONS_ARM_ALL)
+FUNCTIONS.soft_pic.armv7 := $(FUNCTIONS_ARM_ALL)
+FUNCTIONS.hard_pic.armv7 := $(FUNCTIONS_ARM_ALL)
+
+FUNCTIONS.hard_static.i386 := $(FUNCTIONS_I386)
+FUNCTIONS.hard_pic.i386 := $(FUNCTIONS_I386)
+
+FUNCTIONS.hard_static.x86_64 := $(FUNCTIONS_X86_64)
+FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64)
diff --git a/make/platform/clang_linux.mk b/make/platform/clang_linux.mk
index 05efdb6d67ea..5796e8671fc9 100644
--- a/make/platform/clang_linux.mk
+++ b/make/platform/clang_linux.mk
@@ -12,11 +12,9 @@ Configs :=
# 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
# Only define configs if we detected a linux target.
ifneq ($(findstring -linux-,$(CompilerTargetTriple)),)
@@ -63,7 +61,7 @@ endif
# Build runtime libraries for x86_64.
ifeq ($(call contains,$(SupportedArches),x86_64),true)
Configs += full-x86_64 profile-x86_64 san-x86_64 asan-x86_64 tsan-x86_64 \
- msan-x86_64 ubsan-x86_64 ubsan_cxx-x86_64
+ msan-x86_64 ubsan-x86_64 ubsan_cxx-x86_64 dfsan-x86_64 lsan-x86_64
Arch.full-x86_64 := x86_64
Arch.profile-x86_64 := x86_64
Arch.san-x86_64 := x86_64
@@ -72,6 +70,10 @@ Arch.tsan-x86_64 := x86_64
Arch.msan-x86_64 := x86_64
Arch.ubsan-x86_64 := x86_64
Arch.ubsan_cxx-x86_64 := x86_64
+Arch.dfsan-x86_64 := x86_64
+Arch.lsan-x86_64 := x86_64
+endif
+
endif
ifneq ($(LLVM_ANDROID_TOOLCHAIN_DIR),)
@@ -80,7 +82,6 @@ Arch.asan-arm-android := arm-android
endif
endif
-endif
###
@@ -103,6 +104,8 @@ CFLAGS.ubsan-i386 := $(CFLAGS) -m32 $(SANITIZER_CFLAGS) -fno-rtti
CFLAGS.ubsan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
CFLAGS.ubsan_cxx-i386 := $(CFLAGS) -m32 $(SANITIZER_CFLAGS)
CFLAGS.ubsan_cxx-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS)
+CFLAGS.dfsan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS)
+CFLAGS.lsan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
SHARED_LIBRARY.asan-arm-android := 1
ANDROID_COMMON_FLAGS := -target arm-linux-androideabi \
@@ -114,12 +117,10 @@ LDFLAGS.asan-arm-android := $(LDFLAGS) $(ANDROID_COMMON_FLAGS) -ldl \
-Wl,-soname=libclang_rt.asan-arm-android.so
# 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.
+# just do this for the core module, because the stub SDK doesn't have
+# enough support to build the sanitizers or profile runtimes.
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)
@@ -141,6 +142,9 @@ FUNCTIONS.ubsan-i386 := $(UbsanFunctions)
FUNCTIONS.ubsan-x86_64 := $(UbsanFunctions)
FUNCTIONS.ubsan_cxx-i386 := $(UbsanCXXFunctions)
FUNCTIONS.ubsan_cxx-x86_64 := $(UbsanCXXFunctions)
+FUNCTIONS.dfsan-x86_64 := $(DfsanFunctions) $(SanitizerCommonFunctions)
+FUNCTIONS.lsan-x86_64 := $(LsanFunctions) $(InterceptionFunctions) \
+ $(SanitizerCommonFunctions)
# Always use optimized variants.
OPTIMIZED := 1
diff --git a/make/platform/darwin_bni.mk b/make/platform/darwin_bni.mk
index afd04313e62d..03e8d290cffe 100644
--- a/make/platform/darwin_bni.mk
+++ b/make/platform/darwin_bni.mk
@@ -9,12 +9,12 @@ Configs := Debug Release Profile Static
UniversalArchs := $(RC_ARCHS)
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)
- DSYMUTIL := $(shell xcrun -sdk $(SDKROOT) -find dsymutil)
+ override CC := $(shell xcrun -sdk $(SDKROOT) -find clang || echo "false")
+ AR := $(shell xcrun -sdk $(SDKROOT) -find ar || echo "false")
+ RANLIB := $(shell xcrun -sdk $(SDKROOT) -find ranlib || echo "false")
+ STRIP := $(shell xcrun -sdk $(SDKROOT) -find strip || echo "false")
+ LIPO := $(shell xcrun -sdk $(SDKROOT) -find lipo || echo "false")
+ DSYMUTIL := $(shell xcrun -sdk $(SDKROOT) -find dsymutil || echo "false")
endif
ifneq ($(IPHONEOS_DEPLOYMENT_TARGET),)