aboutsummaryrefslogtreecommitdiff
path: root/make/platform
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-01-07 19:55:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-01-07 19:55:37 +0000
commitca9211ecdede9bdedb812b2243a4abdb8dacd1b9 (patch)
tree9b19e801150082c33e9152275829a6ce90614b55 /make/platform
parent8ef50bf3d1c287b5013c3168de77a462dfce3495 (diff)
downloadsrc-ca9211ecdede9bdedb812b2243a4abdb8dacd1b9.tar.gz
src-ca9211ecdede9bdedb812b2243a4abdb8dacd1b9.zip
Import compiler-rt trunk r224034.vendor/compiler-rt/compiler-rt-r224034
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=276789 svn path=/vendor/compiler-rt/compiler-rt-r224034/; revision=276790; tag=vendor/compiler-rt/compiler-rt-r224034
Diffstat (limited to 'make/platform')
-rw-r--r--make/platform/clang_darwin.mk186
-rw-r--r--make/platform/clang_linux.mk64
-rw-r--r--make/platform/clang_macho_embedded.mk (renamed from make/platform/clang_darwin_embedded.mk)56
-rw-r--r--make/platform/clang_macho_embedded_test_input.c0
-rw-r--r--make/platform/darwin_bni.mk10
-rw-r--r--make/platform/darwin_fat.mk2
6 files changed, 203 insertions, 115 deletions
diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk
index ddb702944874..6ed3230a0edd 100644
--- a/make/platform/clang_darwin.mk
+++ b/make/platform/clang_darwin.mk
@@ -1,4 +1,4 @@
-# These are the functions which clang needs when it is targetting a previous
+# These are the functions which clang needs when it is targeting 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
@@ -6,23 +6,37 @@
Description := Static runtime libraries for clang/Darwin.
-# A function that ensures we don't try to build for architectures that we
-# don't have working toolchains for.
+# A function that ensures we don't try to build for architectures and SDKs
+# that we don't have working toolchains for. Arguments:
+# (1): List of architectures
+# (2): Library name
+# (3): SDK path
+# The result is a possibly empty subset of the architectures from argument 1.
CheckArches = \
$(shell \
result=""; \
- for arch in $(1); do \
- if $(CC) -arch $$arch -c \
- -integrated-as \
- $(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \
- -isysroot $(ProjSrcRoot)/SDKs/darwin \
- -o /dev/null > /dev/null 2> /dev/null; then \
- result="$$result$$arch "; \
- else \
- printf 1>&2 \
- "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'\n"; \
- fi; \
- done; \
+ if [ "X$(3)" != X ]; then \
+ for arch in $(1); do \
+ if $(CC) -arch $$arch -c \
+ -integrated-as \
+ $(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \
+ -isysroot $(3) \
+ -o /dev/null > /dev/null 2> /dev/null; then \
+ if $(LD) -v 2>&1 | grep "configured to support" \
+ | tr ' ' '\n' | grep "^$$arch$$" >/dev/null 2>/dev/null; then \
+ result="$$result$$arch "; \
+ else \
+ printf 1>&2 \
+ "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'";\
+ printf 1>&2 " (ld does not support it)\n"; \
+ fi; \
+ else \
+ printf 1>&2 \
+ "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \
+ printf 1>&2 " (clang does not support it)\n"; \
+ fi; \
+ done; \
+ fi; \
echo $$result)
XCRun = \
@@ -38,12 +52,17 @@ XCRunSdkPath = \
###
CC := $(call XCRun,clang)
+LD := $(shell $(CC) -print-prog-name=ld)
AR := $(call XCRun,ar)
RANLIB := $(call XCRun,ranlib)
STRIP := $(call XCRun,strip)
LIPO := $(call XCRun,lipo)
DSYMUTIL := $(call XCRun,dsymutil)
+OSX_SDK := $(call XCRunSdkPath,macosx)
+IOS_SDK := $(call XCRunSdkPath,iphoneos)
+IOSSIM_SDK := $(call XCRunSdkPath,iphonesimulator)
+
Configs :=
UniversalArchs :=
@@ -51,51 +70,53 @@ UniversalArchs :=
# still be referenced from Darwin system headers. This symbol is only ever
# needed on i386.
Configs += eprintf
-UniversalArchs.eprintf := $(call CheckArches,i386,eprintf)
+UniversalArchs.eprintf := $(call CheckArches,i386,eprintf,$(OSX_SDK))
-# Configuration for targetting 10.4. We need a few functions missing from
+# Configuration for targeting 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.
+# support targeting PowerPC.
Configs += 10.4
-UniversalArchs.10.4 := $(call CheckArches,i386 x86_64,10.4)
+UniversalArchs.10.4 := $(call CheckArches,i386 x86_64,10.4,$(OSX_SDK))
-# Configuration for targetting iOS for a couple of functions that didn't
+# Configuration for targeting iOS for a couple of functions that didn't
# make it into libSystem.
Configs += ios
-UniversalArchs.ios := $(call CheckArches,i386 x86_64 armv7,ios)
+UniversalArchs.ios := $(call CheckArches,i386 x86_64,ios,$(IOSSIM_SDK))
+UniversalArchs.ios += $(call CheckArches,armv7 arm64,ios,$(IOS_SDK))
-# Configuration for targetting OSX. These functions may not be in libSystem
+# Configuration for targeting OSX. These functions may not be in libSystem
# so we should provide our own.
Configs += osx
-UniversalArchs.osx := $(call CheckArches,i386 x86_64,osx)
+UniversalArchs.osx := $(call CheckArches,i386 x86_64 x86_64h,osx,$(OSX_SDK))
# Configuration for use with kernel/kexts.
Configs += cc_kext
-UniversalArchs.cc_kext := $(call CheckArches,armv7 i386 x86_64,cc_kext)
+UniversalArchs.cc_kext := $(call CheckArches,i386 x86_64 x86_64h,cc_kext,$(OSX_SDK))
+UniversalArchs.cc_kext += $(call CheckArches,armv7 arm64,cc_kext,$(IOS_SDK))
# Configuration for use with kernel/kexts for iOS 5.0 and earlier (which used
-# a different code generation strategy).
+# a different code generation strategy). Note: the x86_64 slice is unused but
+# it avoids build problems (see pr14013).
Configs += cc_kext_ios5
-UniversalArchs.cc_kext_ios5 := $(call CheckArches,x86_64 armv7,cc_kext_ios5)
+UniversalArchs.cc_kext_ios5 := $(call CheckArches,x86_64,cc_kext_ios5,$(IOSSIM_SDK))
+UniversalArchs.cc_kext_ios5 += $(call CheckArches,armv7,cc_kext_ios5,$(IOS_SDK))
# Configurations which define the profiling support functions.
Configs += profile_osx
-UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64,profile_osx)
+UniversalArchs.profile_osx := $(call CheckArches,i386 x86_64 x86_64h,profile_osx,$(OSX_SDK))
Configs += profile_ios
-UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 armv7,profile_ios)
+UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64,profile_ios,$(IOSSIM_SDK))
+UniversalArchs.profile_ios += $(call CheckArches,armv7 arm64,profile_ios,$(IOS_SDK))
# Configurations which define the ASAN support functions.
Configs += asan_osx_dynamic
-UniversalArchs.asan_osx_dynamic := $(call CheckArches,i386 x86_64,asan_osx_dynamic)
+UniversalArchs.asan_osx_dynamic := $(call CheckArches,i386 x86_64 x86_64h,asan_osx_dynamic,$(OSX_SDK))
-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
+UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64,asan_iossim_dynamic,$(IOSSIM_SDK))
Configs += ubsan_osx
-UniversalArchs.ubsan_osx := $(call CheckArches,i386 x86_64,ubsan_osx)
+UniversalArchs.ubsan_osx := $(call CheckArches,i386 x86_64 x86_64h,ubsan_osx,$(OSX_SDK))
# Darwin 10.6 has a bug in cctools that makes it unable to use ranlib on our ARM
# object files. If we are on that platform, strip out all ARM archs. We still
@@ -110,17 +131,18 @@ endif
# 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)))))
+ $(filter $(RC_SUPPORTED_ARCHS),$(UniversalArchs.$(config)))))
endif
+# Remove empty configs if we end up dropping all the requested
+# archs for a particular config.
+$(foreach config,$(Configs),\
+ $(if $(strip $(UniversalArchs.$(config))),,\
+ $(call Set,Configs,$(filter-out $(config),$(Configs)))))
+
###
# Forcibly strip off any -arch, as that totally breaks our universal support.
@@ -138,90 +160,97 @@ IOS_DEPLOYMENT_ARGS := -mios-version-min=1.0
IOS6_DEPLOYMENT_ARGS := -mios-version-min=6.0
IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=1.0
-# 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
-IOS6_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin
-IOSSIM_DEPLOYMENT_ARGS += -isysroot $(ProjSrcRoot)/SDKs/darwin
+OSX_DEPLOYMENT_ARGS += -isysroot $(OSX_SDK)
+IOS_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK)
+IOS6_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK)
+IOSSIM_DEPLOYMENT_ARGS += -isysroot $(IOSSIM_SDK)
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.6 -fno-builtin \
+ $(CFLAGS) -mmacosx-version-min=10.7 \
+ -isysroot $(OSX_SDK) \
+ -fno-builtin \
-gline-tables-only \
- -DMAC_INTERPOSE_FUNCTIONS=1 \
- -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
+ -DMAC_INTERPOSE_FUNCTIONS=1
CFLAGS.asan_iossim_dynamic := \
$(CFLAGS) -mios-simulator-version-min=7.0 \
- -isysroot $(IOSSIM_SDK_PATH) \
+ -isysroot $(IOSSIM_SDK) \
-fno-builtin \
-gline-tables-only \
- -DMAC_INTERPOSE_FUNCTIONS=1 \
- -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
+ -DMAC_INTERPOSE_FUNCTIONS=1
-CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.6 -fno-builtin
+CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.6 \
+ -isysroot $(OSX_SDK) \
+ -fno-builtin
CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
CFLAGS.ios.armv7 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
-CFLAGS.ios.armv7f := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
CFLAGS.ios.armv7k := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
CFLAGS.ios.armv7s := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
+CFLAGS.ios.arm64 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
CFLAGS.osx.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
CFLAGS.osx.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
+CFLAGS.osx.x86_64h := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
CFLAGS.cc_kext.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
CFLAGS.cc_kext.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
+CFLAGS.cc_kext.x86_64h := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
CFLAGS.cc_kext.armv7 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
-CFLAGS.cc_kext.armv7f := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
CFLAGS.cc_kext.armv7k := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
CFLAGS.cc_kext.armv7s := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
+CFLAGS.cc_kext.arm64 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
CFLAGS.cc_kext_ios5.armv7 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
-CFLAGS.cc_kext_ios5.armv7f := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
CFLAGS.cc_kext_ios5.armv7k := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
CFLAGS.cc_kext_ios5.armv7s := $(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_osx.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
+CFLAGS.profile_osx.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
+CFLAGS.profile_osx.x86_64h := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS)
+CFLAGS.profile_ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
+CFLAGS.profile_ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
CFLAGS.profile_ios.armv7 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
-CFLAGS.profile_ios.armv7f := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
CFLAGS.profile_ios.armv7k := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
CFLAGS.profile_ios.armv7s := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS)
+CFLAGS.profile_ios.arm64 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS)
# Configure the asan_osx_dynamic library to be built shared.
SHARED_LIBRARY.asan_osx_dynamic := 1
-LDFLAGS.asan_osx_dynamic := -lstdc++ -undefined dynamic_lookup
+LDFLAGS.asan_osx_dynamic := -lstdc++ -undefined dynamic_lookup -install_name @rpath/libclang_rt.asan_osx_dynamic.dylib
# 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 \
+LDFLAGS.asan_iossim_dynamic := -undefined dynamic_lookup -install_name @rpath/libclang_rt.asan_iossim_dynamic.dylib \
-Wl,-ios_simulator_version_min,7.0.0 \
- -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK_PATH)
+ -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK)
FUNCTIONS.eprintf := eprintf
FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf
FUNCTIONS.ios := divmodsi4 udivmodsi4 mulosi4 mulodi4 muloti4
# On x86, the divmod functions reference divsi.
-FUNCTIONS.ios.i386 := $(FUNCTIONS.ios) \
- divsi3 udivsi3
-FUNCTIONS.ios.x86_64 := $(FUNCTIONS.ios) \
- divsi3 udivsi3
+FUNCTIONS.ios.i386 := $(FUNCTIONS.ios) \
+ divsi3 udivsi3
+FUNCTIONS.ios.x86_64 := $(FUNCTIONS.ios.i386)
+FUNCTIONS.ios.arm64 := mulsc3 muldc3 divsc3 divdc3
FUNCTIONS.osx := mulosi4 mulodi4 muloti4
-FUNCTIONS.profile_osx := GCDAProfiling
-FUNCTIONS.profile_ios := GCDAProfiling
+FUNCTIONS.profile_osx := GCDAProfiling InstrProfiling InstrProfilingBuffer \
+ InstrProfilingFile InstrProfilingPlatformDarwin \
+ InstrProfilingRuntime
+FUNCTIONS.profile_ios := $(FUNCTIONS.profile_osx)
-FUNCTIONS.asan_osx_dynamic := $(AsanFunctions) $(InterceptionFunctions) \
+FUNCTIONS.asan_osx_dynamic := $(AsanFunctions) $(AsanCXXFunctions) \
+ $(InterceptionFunctions) \
$(SanitizerCommonFunctions) \
$(AsanDynamicFunctions)
-FUNCTIONS.asan_iossim_dynamic := $(AsanFunctions) $(InterceptionFunctions) \
+FUNCTIONS.asan_iossim_dynamic := $(AsanFunctions) $(AsanCXXFunctions) \
+ $(InterceptionFunctions) \
$(SanitizerCommonFunctions) \
$(AsanDynamicFunctions)
@@ -374,11 +403,10 @@ CCKEXT_ARMVFP_FUNCTIONS := $(CCKEXT_ARM_FUNCTIONS) \
unordsf2vfp
FUNCTIONS.cc_kext.armv7 := $(CCKEXT_ARMVFP_FUNCTIONS)
-FUNCTIONS.cc_kext.armv7f := $(CCKEXT_ARMVFP_FUNCTIONS)
FUNCTIONS.cc_kext.armv7k := $(CCKEXT_ARMVFP_FUNCTIONS)
FUNCTIONS.cc_kext.armv7s := $(CCKEXT_ARMVFP_FUNCTIONS)
+FUNCTIONS.cc_kext.arm64 := mulsc3 muldc3 divsc3 divdc3
FUNCTIONS.cc_kext_ios5.armv7 := $(CCKEXT_ARMVFP_FUNCTIONS)
-FUNCTIONS.cc_kext_ios5.armv7f := $(CCKEXT_ARMVFP_FUNCTIONS)
FUNCTIONS.cc_kext_ios5.armv7k := $(CCKEXT_ARMVFP_FUNCTIONS)
FUNCTIONS.cc_kext_ios5.armv7s := $(CCKEXT_ARMVFP_FUNCTIONS)
@@ -438,6 +466,8 @@ FUNCTIONS.cc_kext.x86_64 := $(CCKEXT_X86_FUNCTIONS) \
udivti3 \
umodti3
+FUNCTIONS.cc_kext.x86_64h := $(FUNCTIONS.cc_kext.x86_64)
+
# 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 := \
@@ -457,16 +487,14 @@ CCKEXT_MISSING_FUNCTIONS := \
FUNCTIONS.cc_kext.armv7 := \
$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.armv7))
-FUNCTIONS.cc_kext.armv7f := \
- $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.armv7f))
FUNCTIONS.cc_kext.armv7k := \
$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.armv7k))
FUNCTIONS.cc_kext.armv7s := \
$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.armv7s))
+FUNCTIONS.cc_kext.arm64 := \
+ $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.arm64))
FUNCTIONS.cc_kext_ios5.armv7 := \
$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios5.armv7))
-FUNCTIONS.cc_kext_ios5.armv7f := \
- $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios5.armv7f))
FUNCTIONS.cc_kext_ios5.armv7k := \
$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios5.armv7k))
FUNCTIONS.cc_kext_ios5.armv7s := \
@@ -475,6 +503,8 @@ 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))
+FUNCTIONS.cc_kext.x86_64h := \
+ $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.x86_64h))
KERNEL_USE.cc_kext := 1
KERNEL_USE.cc_kext_ios5 := 1
diff --git a/make/platform/clang_linux.mk b/make/platform/clang_linux.mk
index 5796e8671fc9..fc4405734840 100644
--- a/make/platform/clang_linux.mk
+++ b/make/platform/clang_linux.mk
@@ -11,7 +11,7 @@ Configs :=
# cross compilers). For now, we just find the target architecture of the
# compiler and only define configurations we know that compiler can generate.
CompilerTargetTriple := $(shell \
- $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2)
+ LANG=C $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2)
ifeq ($(CompilerTargetTriple),)
$(error "unable to infer compiler target triple for $(CC)")
endif
@@ -49,23 +49,27 @@ endif
# Build runtime libraries for i386.
ifeq ($(call contains,$(SupportedArches),i386),true)
-Configs += full-i386 profile-i386 san-i386 asan-i386 ubsan-i386 ubsan_cxx-i386
-Arch.full-i386 := i386
+Configs += builtins-i386 profile-i386 san-i386 asan-i386 asan_cxx-i386 \
+ ubsan-i386 ubsan_cxx-i386
+Arch.builtins-i386 := i386
Arch.profile-i386 := i386
Arch.san-i386 := i386
Arch.asan-i386 := i386
+Arch.asan_cxx-i386 := i386
Arch.ubsan-i386 := i386
Arch.ubsan_cxx-i386 := i386
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 dfsan-x86_64 lsan-x86_64
-Arch.full-x86_64 := x86_64
+Configs += builtins-x86_64 profile-x86_64 san-x86_64 asan-x86_64 asan_cxx-x86_64 \
+ tsan-x86_64 msan-x86_64 ubsan-x86_64 ubsan_cxx-x86_64 dfsan-x86_64 \
+ lsan-x86_64
+Arch.builtins-x86_64 := x86_64
Arch.profile-x86_64 := x86_64
Arch.san-x86_64 := x86_64
Arch.asan-x86_64 := x86_64
+Arch.asan_cxx-x86_64 := x86_64
Arch.tsan-x86_64 := x86_64
Arch.msan-x86_64 := x86_64
Arch.ubsan-x86_64 := x86_64
@@ -88,52 +92,57 @@ endif
CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer
SANITIZER_CFLAGS := -fPIE -fno-builtin -gline-tables-only
-CFLAGS.full-i386 := $(CFLAGS) -m32
-CFLAGS.full-x86_64 := $(CFLAGS) -m64
+CFLAGS.builtins-i386 := $(CFLAGS) -m32
+CFLAGS.builtins-x86_64 := $(CFLAGS) -m64
CFLAGS.profile-i386 := $(CFLAGS) -m32
CFLAGS.profile-x86_64 := $(CFLAGS) -m64
CFLAGS.san-i386 := $(CFLAGS) -m32 $(SANITIZER_CFLAGS) -fno-rtti
CFLAGS.san-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
-CFLAGS.asan-i386 := $(CFLAGS) -m32 $(SANITIZER_CFLAGS) -fno-rtti \
- -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
-CFLAGS.asan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti \
- -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
+CFLAGS.asan-i386 := $(CFLAGS) -m32 $(SANITIZER_CFLAGS) -fno-rtti
+CFLAGS.asan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
+CFLAGS.asan_cxx-i386 := $(CFLAGS) -m32 $(SANITIZER_CFLAGS) -fno-rtti
+CFLAGS.asan_cxx-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
CFLAGS.tsan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
CFLAGS.msan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
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.dfsan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
CFLAGS.lsan-x86_64 := $(CFLAGS) -m64 $(SANITIZER_CFLAGS) -fno-rtti
SHARED_LIBRARY.asan-arm-android := 1
ANDROID_COMMON_FLAGS := -target arm-linux-androideabi \
--sysroot=$(LLVM_ANDROID_TOOLCHAIN_DIR)/sysroot \
-B$(LLVM_ANDROID_TOOLCHAIN_DIR)
-CFLAGS.asan-arm-android := $(CFLAGS) -fPIC -fno-builtin \
- $(ANDROID_COMMON_FLAGS) -mllvm -arm-enable-ehabi -fno-rtti
-LDFLAGS.asan-arm-android := $(LDFLAGS) $(ANDROID_COMMON_FLAGS) -ldl \
- -Wl,-soname=libclang_rt.asan-arm-android.so
+CFLAGS.asan-arm-android := $(CFLAGS) $(SANITIZER_CFLAGS) \
+ $(ANDROID_COMMON_FLAGS) -fno-rtti
+LDFLAGS.asan-arm-android := $(LDFLAGS) $(ANDROID_COMMON_FLAGS) -ldl -lm -llog \
+ -lstdc++ -Wl,-soname=libclang_rt.asan-arm-android.so -Wl,-z,defs
# Use our stub SDK as the sysroot to support more portable building. For now we
# 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
-
-FUNCTIONS.full-i386 := $(CommonFunctions) $(ArchFunctions.i386)
-FUNCTIONS.full-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64)
-FUNCTIONS.profile-i386 := GCDAProfiling
-FUNCTIONS.profile-x86_64 := GCDAProfiling
+CFLAGS.builtins-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux
+CFLAGS.builtins-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux
+
+FUNCTIONS.builtins-i386 := $(CommonFunctions) $(ArchFunctions.i386)
+FUNCTIONS.builtins-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64)
+FUNCTIONS.profile-i386 := GCDAProfiling InstrProfiling InstrProfilingBuffer \
+ InstrProfilingFile InstrProfilingPlatformOther \
+ InstrProfilingRuntime
+FUNCTIONS.profile-x86_64 := $(FUNCTIONS.profile-i386)
FUNCTIONS.san-i386 := $(SanitizerCommonFunctions)
FUNCTIONS.san-x86_64 := $(SanitizerCommonFunctions)
FUNCTIONS.asan-i386 := $(AsanFunctions) $(InterceptionFunctions) \
$(SanitizerCommonFunctions)
FUNCTIONS.asan-x86_64 := $(AsanFunctions) $(InterceptionFunctions) \
$(SanitizerCommonFunctions) $(LsanCommonFunctions)
-FUNCTIONS.asan-arm-android := $(AsanFunctions) $(InterceptionFunctions) \
- $(SanitizerCommonFunctions)
+FUNCTIONS.asan_cxx-i386 := $(AsanCXXFunctions)
+FUNCTIONS.asan_cxx-x86_64 := $(AsanCXXFunctions)
+FUNCTIONS.asan-arm-android := $(AsanFunctions) $(AsanCXXFunctions) \
+ $(InterceptionFunctions) \
+ $(SanitizerCommonFunctions)
FUNCTIONS.tsan-x86_64 := $(TsanFunctions) $(InterceptionFunctions) \
$(SanitizerCommonFunctions)
FUNCTIONS.msan-x86_64 := $(MsanFunctions) $(InterceptionFunctions) \
@@ -142,7 +151,8 @@ 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.dfsan-x86_64 := $(DfsanFunctions) $(InterceptionFunctions) \
+ $(SanitizerCommonFunctions)
FUNCTIONS.lsan-x86_64 := $(LsanFunctions) $(InterceptionFunctions) \
$(SanitizerCommonFunctions)
diff --git a/make/platform/clang_darwin_embedded.mk b/make/platform/clang_macho_embedded.mk
index 3cea2e45c8ab..76e43e66cdb7 100644
--- a/make/platform/clang_darwin_embedded.mk
+++ b/make/platform/clang_macho_embedded.mk
@@ -1,4 +1,4 @@
-# These are the functions which clang needs when it is targetting a previous
+# These are the functions which clang needs when it is targeting 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
@@ -6,6 +6,24 @@
Description := Static runtime libraries for embedded clang/Darwin
+# A function that ensures we don't try to build for architectures that we
+# don't have working toolchains for.
+CheckArches = \
+ $(shell \
+ result=""; \
+ for arch in $(1); do \
+ if $(CC) -arch $$arch -c \
+ -integrated-as \
+ $(ProjSrcRoot)/make/platform/clang_macho_embedded_test_input.c \
+ -o /dev/null > /dev/null 2> /dev/null; then \
+ result="$$result$$arch "; \
+ else \
+ printf 1>&2 \
+ "warning: clang_macho_embedded.mk: dropping arch '$$arch' from lib '$(2)'\n"; \
+ fi; \
+ done; \
+ echo $$result)
+
XCRun = \
$(shell \
result=`xcrun -find $(1) 2> /dev/null`; \
@@ -27,20 +45,20 @@ 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
+UniversalArchs.soft_static := $(call CheckArches,armv6m armv7m armv7em armv7,soft_static)
+Configs += $(if $(UniversalArchs.soft_static),soft_static)
# 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
+UniversalArchs.hard_static := $(call CheckArches,armv7em armv7 i386 x86_64,hard_static)
+Configs += $(if $(UniversalArchs.hard_static),hard_static)
-Configs += soft_pic
-UniversalArchs.soft_pic := armv6m armv7m armv7em armv7
+UniversalArchs.soft_pic := $(call CheckArches,armv6m armv7m armv7em armv7,soft_pic)
+Configs += $(if $(UniversalArchs.soft_pic),soft_pic)
-Configs += hard_pic
-UniversalArchs.hard_pic := armv7em armv7 i386 x86_64
+UniversalArchs.hard_pic := $(call CheckArches,armv7em armv7 i386 x86_64,hard_pic)
+Configs += $(if $(UniversalArchs.hard_pic),hard_pic)
CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding
@@ -186,6 +204,26 @@ THUMB2_FUNCTIONS := \
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
I386_FUNCTIONS := \
i686.get_pc_thunk.eax \
diff --git a/make/platform/clang_macho_embedded_test_input.c b/make/platform/clang_macho_embedded_test_input.c
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/make/platform/clang_macho_embedded_test_input.c
diff --git a/make/platform/darwin_bni.mk b/make/platform/darwin_bni.mk
index 03e8d290cffe..229609a185df 100644
--- a/make/platform/darwin_bni.mk
+++ b/make/platform/darwin_bni.mk
@@ -115,3 +115,13 @@ FUNCTIONS.armv7 := $(FUNCTIONS) \
FUNCTIONS.armv7s := $(FUNCTIONS.armv7)
+FUNCTIONS.arm64 := divti3 modti3 \
+ udivmodti4 \
+ udivti3 umodti3 \
+ powisf2 powidf2 \
+ clzti2 \
+ fixdfti fixsfti \
+ fixunsdfti fixunssfti fixunssfti \
+ floattidf floattisf floatuntidf floatuntisf \
+ gcc_personality_v0 atomic
+
diff --git a/make/platform/darwin_fat.mk b/make/platform/darwin_fat.mk
index 54936a39ffb9..65ecd75c9adf 100644
--- a/make/platform/darwin_fat.mk
+++ b/make/platform/darwin_fat.mk
@@ -8,7 +8,7 @@
# software floating point).
#
# This section must define one of:
-# UniveralArchs - A list of architectures to build for, when using universal build
+# UniversalArchs - 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