diff options
author | Keno Fischer <kfischer@college.harvard.edu> | 2015-10-05 22:24:12 +0000 |
---|---|---|
committer | Keno Fischer <kfischer@college.harvard.edu> | 2015-10-05 22:24:12 +0000 |
commit | efecb2c285bd444b6def43ac62e5f0278df387eb (patch) | |
tree | f708d793ddae27661efb76025a21459dcc7d31c9 /make/platform | |
parent | ea02fa45225c35613bfecab383fb526e24b74497 (diff) |
[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
Diffstat (limited to 'make/platform')
-rw-r--r-- | make/platform/clang_darwin.mk | 16 | ||||
-rw-r--r-- | 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 3a034b8f9..dff26943b 100644 --- a/make/platform/clang_darwin.mk +++ b/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 b7074b852..b406a28a6 100644 --- a/make/platform/clang_darwin_test_input.c +++ b/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)); +} |