[PATCH] D13425: [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
Sun Oct 4 12:17:24 PDT 2015


loladiro created this revision.
loladiro added a reviewer: beanz.
loladiro added a subscriber: llvm-commits.
loladiro set the repository for this revision to rL LLVM.

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.

Repository:
  rL LLVM

http://reviews.llvm.org/D13425

Files:
  make/platform/clang_darwin.mk
  make/platform/clang_darwin_test_input.c

Index: make/platform/clang_darwin_test_input.c
===================================================================
--- make/platform/clang_darwin_test_input.c
+++ 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));
+}
Index: make/platform/clang_darwin.mk
===================================================================
--- make/platform/clang_darwin.mk
+++ make/platform/clang_darwin.mk
@@ -17,23 +17,23 @@
     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; \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13425.36474.patch
Type: text/x-patch
Size: 2155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151004/9231ecda/attachment.bin>


More information about the llvm-commits mailing list