[compiler-rt] r249358 - [compiler-rt] Properly detect lack of available system libraries for arch in clang_darwin.mk
Keno Fischer via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 5 15:24:13 PDT 2015
Author: kfischer
Date: Mon Oct 5 17:24:12 2015
New Revision: 249358
URL: http://llvm.org/viewvc/llvm-project?rev=249358&view=rev
Log:
[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
Modified:
compiler-rt/trunk/make/platform/clang_darwin.mk
compiler-rt/trunk/make/platform/clang_darwin_test_input.c
Modified: compiler-rt/trunk/make/platform/clang_darwin.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin.mk?rev=249358&r1=249357&r2=249358&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_darwin.mk (original)
+++ compiler-rt/trunk/make/platform/clang_darwin.mk Mon Oct 5 17:24:12 2015
@@ -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; \
Modified: compiler-rt/trunk/make/platform/clang_darwin_test_input.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin_test_input.c?rev=249358&r1=249357&r2=249358&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_darwin_test_input.c (original)
+++ compiler-rt/trunk/make/platform/clang_darwin_test_input.c Mon Oct 5 17:24:12 2015
@@ -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));
+}
More information about the llvm-commits
mailing list