[llvm-commits] [128845] Make weak_import work for LLVM.

johannes at apple.com johannes at apple.com
Tue Jun 26 17:16:20 PDT 2007


Revision: 128845
Author:   johannes
Date:     2007-06-26 17:16:19 -0700 (Tue, 26 Jun 2007)

Log Message:
-----------
Make weak_import work for LLVM.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/config/darwin.h

Modified: apple-local/branches/llvm/gcc/config/darwin.h
===================================================================
--- apple-local/branches/llvm/gcc/config/darwin.h	2007-06-26 21:59:14 UTC (rev 128844)
+++ apple-local/branches/llvm/gcc/config/darwin.h	2007-06-27 00:16:19 UTC (rev 128845)
@@ -673,6 +673,23 @@
     fputc ('\n', FILE);							\
   } while (0)
 
+/* APPLE LOCAL begin LLVM */
+/* weak_import, a Darwin special, does not make function definitions weak. */
+#define TARGET_ADJUST_LLVM_LINKAGE(FN, DECL)                            \
+  do {                                                                  \
+    if ((DECL) &&                                                       \
+        TREE_CODE (DECL) == FUNCTION_DECL &&                            \
+        !DECL_EXTERNAL (DECL) &&                                        \
+        TREE_PUBLIC (DECL) &&                                           \
+        DECL_WEAK (DECL) &&                                             \
+        ! lookup_attribute ("weak", DECL_ATTRIBUTES (DECL)) &&          \
+	lookup_attribute ("weak_import", DECL_ATTRIBUTES (DECL)) &&     \
+        (FN)->hasWeakLinkage()) {                                       \
+      (FN)->setLinkage(Function::ExternalLinkage);                      \
+    }                                                                   \
+  } while (0)
+/* APPLE LOCAL end LLVM */
+
 /* Darwin has the pthread routines in libSystem, which every program
    links to, so there's no need for weak-ness for that.  */
 #define GTHREAD_USE_WEAK 0





More information about the llvm-commits mailing list