summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-12-11 11:25:53 +0000
committerTim Northover <tnorthover@apple.com>2013-12-11 11:25:53 +0000
commit1d1b3a0be5bc3bb6ec6cd41ab13e57442395fc30 (patch)
treee96ac3a4173fc59101ff42e831a6b4b9b102c5e9 /make
parent60037927fdcfed87567a391c0adfddfe55cdf37a (diff)
Only build embedded darwin variants if the compiler supports them
We need to filter out architectures that the compiler hasn't been built to target (most likely the ARM ones) before attemptint to build a version of libcompiler_rt. This can result in a completely empty library (e.g. soft-float doesn't have any x86 variants), in which case we shouldn't even try the build git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'make')
-rw-r--r--make/platform/clang_darwin_embedded.mk35
1 files changed, 27 insertions, 8 deletions
diff --git a/make/platform/clang_darwin_embedded.mk b/make/platform/clang_darwin_embedded.mk
index 3cea2e45c..4398c12ee 100644
--- a/make/platform/clang_darwin_embedded.mk
+++ b/make/platform/clang_darwin_embedded.mk
@@ -6,6 +6,25 @@
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_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; \
+ echo $$result)
+
XCRun = \
$(shell \
result=`xcrun -find $(1) 2> /dev/null`; \
@@ -27,20 +46,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