diff --git a/deps/Makefile b/deps/Makefile index fa2df33ef9eb9..d06f6706a4aa4 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -677,6 +677,9 @@ ifeq ($(LLVM_VER),3.7.1) ifeq ($(BUILD_LLDB),1) $(eval $(call LLVM_PATCH,lldb-3.7.1)) endif +ifeq ($(BUILD_LLVM_CLANG),1) +$(eval $(call LLVM_PATCH,compiler-rt-3.7.1)) +endif endif LLVM_BUILDDIR_withtype := $(LLVM_BUILD_DIR)/build_$(LLVM_BUILDTYPE) diff --git a/deps/compiler-rt-3.7.1.patch b/deps/compiler-rt-3.7.1.patch new file mode 100644 index 0000000000000..3c91eaebfd8f4 --- /dev/null +++ b/deps/compiler-rt-3.7.1.patch @@ -0,0 +1,73 @@ +From efecb2c285bd444b6def43ac62e5f0278df387eb Mon Sep 17 00:00:00 2001 +From: Keno Fischer +Date: Mon, 5 Oct 2015 22:24:12 +0000 +Subject: [PATCH] [compiler-rt] Properly detect lack of available system + libraries for arch in clang_darwin.mk + +Summary: This is the Makefile analog of r247833, except that the test also had to be changed such that clang actually attempts to link the program as opposed to just building it. Because of that change, I also switched the order to checking for ld/clang architecture support, because now lack of ld support would make the clang check fail. This fixes PR24776. + +Reviewers: beanz + +Subscribers: llvm-commits + +Differential Revision: http://reviews.llvm.org/D13425 + +git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@249358 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + make/platform/clang_darwin.mk | 16 ++++++++-------- + make/platform/clang_darwin_test_input.c | 9 +++++++++ + 2 files changed, 17 insertions(+), 8 deletions(-) + +diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk +index 3a034b8..dff2694 100644 +--- a/projects/compiler-rt/make/platform/clang_darwin.mk ++++ b/projects/compiler-rt/make/platform/clang_darwin.mk +@@ -17,23 +17,23 @@ CheckArches = \ + result=""; \ + if [ "X$(3)" != X ]; then \ + for arch in $(1); do \ +- if $(CC) -arch $$arch -c \ ++ if $(LD) -v 2>&1 | grep "configured to support" \ ++ | tr ' ' '\n' | grep "^$$arch$$" >/dev/null 2>/dev/null; then \ ++ if $(CC) -arch $$arch \ + -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 "; \ ++ 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"; \ ++ "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \ ++ printf 1>&2 " (clang or system libraries do 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"; \ ++ "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'";\ ++ printf 1>&2 " (ld does not support it)\n"; \ + fi; \ + done; \ + fi; \ +diff --git a/make/platform/clang_darwin_test_input.c b/make/platform/clang_darwin_test_input.c +index b7074b8..b406a28 100644 +--- a/projects/compiler-rt/make/platform/clang_darwin_test_input.c ++++ b/projects/compiler-rt/make/platform/clang_darwin_test_input.c +@@ -4,3 +4,12 @@ + #include + #include + #include ++#include ++ ++// Force us to link at least one symbol in a system library ++// to detect systems where we don't have those for a given ++// architecture. ++int main(int argc, const char **argv) { ++ int x; ++ memcpy(&x,&argc,sizeof(int)); ++}