diff options
author | Stephen Hines <srhines@google.com> | 2014-05-28 23:58:16 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-05-28 23:58:16 -0700 |
commit | 2d1fdb26e458c4ddc04155c1d421bced3ba90cd0 (patch) | |
tree | 346e1f796459c260b140e25df8a68336f9219624 /make | |
parent | 6355b699b2bf305d2ea739b2c48d6286e8db8272 (diff) | |
download | compiler-rt-2d1fdb26e458c4ddc04155c1d421bced3ba90cd0.tar.gz |
Update compiler-rt aosp/master for 3.5 (r209699) rebase.
Change-Id: I158a30186f0faea2e2400e9dfdd878db2eb40e90
Diffstat (limited to 'make')
-rw-r--r-- | make/config.mk | 6 | ||||
-rw-r--r-- | make/platform/clang_darwin.mk | 106 | ||||
-rw-r--r-- | make/platform/clang_linux.mk | 57 | ||||
-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.c | 0 | ||||
-rw-r--r-- | make/platform/darwin_fat.mk | 2 | ||||
-rw-r--r-- | make/subdir.mk | 11 |
7 files changed, 149 insertions, 89 deletions
diff --git a/make/config.mk b/make/config.mk index 6398d058d..094fd160f 100644 --- a/make/config.mk +++ b/make/config.mk @@ -43,5 +43,7 @@ endif ### # Common compiler options -COMMON_CXXFLAGS=-fno-exceptions -fPIC -funwind-tables -I${ProjSrcRoot}/lib -I${ProjSrcRoot}/include -COMMON_CFLAGS=-fPIC +COMMON_INCLUDES=-I${ProjSrcRoot}/lib -I${ProjSrcRoot}/include +COMMON_CXXFLAGS=-std=c++11 -fno-exceptions -fPIC -funwind-tables $(COMMON_INCLUDES) +COMMON_CFLAGS=-fPIC $(COMMON_INCLUDES) +COMMON_ASMFLAGS=$(COMMON_INCLUDES) diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk index ddb702944..50f8b01de 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 @@ -13,14 +13,22 @@ CheckArches = \ 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 "; \ + -integrated-as \ + $(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \ + -isysroot $(ProjSrcRoot)/SDKs/darwin \ + -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)'\n"; \ + printf 1>&2 \ + "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \ + printf 1>&2 " (clang does not support it)\n"; \ fi; \ done; \ echo $$result) @@ -38,6 +46,7 @@ XCRunSdkPath = \ ### CC := $(call XCRun,clang) +LD := $(shell $(CC) -print-prog-name=ld) AR := $(call XCRun,ar) RANLIB := $(call XCRun,ranlib) STRIP := $(call XCRun,strip) @@ -53,49 +62,49 @@ UniversalArchs := Configs += eprintf UniversalArchs.eprintf := $(call CheckArches,i386,eprintf) -# 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) -# 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 x86_64h armv7,ios) -# 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) # 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,armv7 i386 x86_64 x86_64h,cc_kext) # Configuration for use with kernel/kexts for iOS 5.0 and earlier (which used # a different code generation strategy). Configs += cc_kext_ios5 -UniversalArchs.cc_kext_ios5 := $(call CheckArches,x86_64 armv7,cc_kext_ios5) +UniversalArchs.cc_kext_ios5 := $(call CheckArches,x86_64 x86_64h armv7,cc_kext_ios5) # 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) Configs += profile_ios -UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 armv7,profile_ios) +UniversalArchs.profile_ios := $(call CheckArches,i386 x86_64 x86_64h armv7,profile_ios) # 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) 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) +UniversalArchs.asan_iossim_dynamic := $(call CheckArches,i386 x86_64 x86_64h,asan_iossim_dynamic) endif 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) # 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 @@ -150,43 +159,42 @@ CFLAGS.10.4 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) CFLAGS.asan_osx_dynamic := \ $(CFLAGS) -mmacosx-version-min=10.6 -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) \ -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 -fno-builtin CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) +CFLAGS.ios.x86_64h := $(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.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_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.x86_64h := $(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) @@ -207,21 +215,25 @@ 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.x86_64h := $(FUNCTIONS.ios.x86_64) 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 +386,9 @@ 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_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 +448,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 +469,12 @@ 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_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 +483,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 5796e8671..37708f89c 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,42 +92,43 @@ 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 \ + -I$(ProjSrcRoot)/android/include +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 +CFLAGS.builtins-i386 += --sysroot=$(ProjSrcRoot)/SDKs/linux +CFLAGS.builtins-x86_64 += --sysroot=$(ProjSrcRoot)/SDKs/linux -FUNCTIONS.full-i386 := $(CommonFunctions) $(ArchFunctions.i386) -FUNCTIONS.full-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) +FUNCTIONS.builtins-i386 := $(CommonFunctions) $(ArchFunctions.i386) +FUNCTIONS.builtins-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) FUNCTIONS.profile-i386 := GCDAProfiling FUNCTIONS.profile-x86_64 := GCDAProfiling FUNCTIONS.san-i386 := $(SanitizerCommonFunctions) @@ -132,8 +137,11 @@ 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 +150,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 3cea2e45c..76e43e66c 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 000000000..e69de29bb --- /dev/null +++ b/make/platform/clang_macho_embedded_test_input.c diff --git a/make/platform/darwin_fat.mk b/make/platform/darwin_fat.mk index 54936a39f..65ecd75c9 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 diff --git a/make/subdir.mk b/make/subdir.mk index 6dadc7b61..f81c25f03 100644 --- a/make/subdir.mk +++ b/make/subdir.mk @@ -2,12 +2,13 @@ # # Subdirectory makefiles must define: # SubDirs - The subdirectories to traverse. +# +# Subdirectory makefiles may define: +# ModuleName - The library name for objects in that directory. # ObjNames - The objects available in that directory. # Implementation - The library configuration the objects should go in (Generic # or Optimized) # Dependencies - Any dependences for the object files. -# -# Subdirectory makefiles may define: # OnlyArchs - Only build the objects for the listed archs. # OnlyConfigs - Only build the objects for the listed configurations. @@ -20,9 +21,9 @@ endif # The list of variables which are intended to be overridden in a subdirectory # makefile. -RequiredSubdirVariables := \ - ModuleName SubDirs ObjNames Implementation Dependencies -OptionalSubdirVariables := OnlyArchs OnlyConfigs +RequiredSubdirVariables := SubDirs +OptionalSubdirVariables := ModuleName OnlyArchs OnlyConfigs \ + ObjNames Implementation Dependencies # Template: subdir_traverse_template subdir define subdir_traverse_template |