Skip to content

Commit

Permalink
Add OS X compiler rt 3.7.1 patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Jan 17, 2016
1 parent b992fe6 commit 876240c
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
3 changes: 3 additions & 0 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
73 changes: 73 additions & 0 deletions deps/compiler-rt-3.7.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From efecb2c285bd444b6def43ac62e5f0278df387eb Mon Sep 17 00:00:00 2001
From: Keno Fischer <kfischer@college.harvard.edu>
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 <stdint.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
+
+// 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));
+}

0 comments on commit 876240c

Please sign in to comment.