[llvm-branch-commits] [cfe-branch] r73444 - in /cfe/branches/Apple/Dib: lib/CodeGen/CodeGenModule.cpp test/CodeGen/attributes.c

Daniel Dunbar daniel at zuster.org
Mon Jun 15 16:39:14 PDT 2009


Author: ddunbar
Date: Mon Jun 15 18:39:14 2009
New Revision: 73444

URL: http://llvm.org/viewvc/llvm-project?rev=73444&view=rev
Log:
Merge in 72967:

------------------------------------------------------------------------
r72967 | ddunbar | 2009-06-05 15:58:34 -0700 (Fri, 05 Jun 2009) | 3 lines

weak_import should not make definitions have weak linkage.
 - <rdar://problem/6948703> clang treats weak_import like weak

------------------------------------------------------------------------

Modified:
    cfe/branches/Apple/Dib/lib/CodeGen/CodeGenModule.cpp
    cfe/branches/Apple/Dib/test/CodeGen/attributes.c

Modified: cfe/branches/Apple/Dib/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CodeGenModule.cpp?rev=73444&r1=73443&r2=73444&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CodeGenModule.cpp Mon Jun 15 18:39:14 2009
@@ -280,7 +280,7 @@
     GV->setLinkage(llvm::Function::InternalLinkage);
   } else if (D->hasAttr<DLLExportAttr>()) {
     GV->setLinkage(llvm::Function::DLLExportLinkage);
-  } else if (D->hasAttr<WeakAttr>() || D->hasAttr<WeakImportAttr>()) {
+  } else if (D->hasAttr<WeakAttr>()) {
     GV->setLinkage(llvm::Function::WeakAnyLinkage);
   } else if (Linkage == GVA_C99Inline) {
     // In C99 mode, 'inline' functions are guaranteed to have a strong
@@ -817,7 +817,7 @@
     GV->setLinkage(llvm::Function::DLLImportLinkage);
   else if (D->hasAttr<DLLExportAttr>())
     GV->setLinkage(llvm::Function::DLLExportLinkage);
-  else if (D->hasAttr<WeakAttr>() || D->hasAttr<WeakImportAttr>())
+  else if (D->hasAttr<WeakAttr>())
     GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage);
   else if (!CompileOpts.NoCommon &&
            (!D->hasExternalStorage() && !D->getInit()))

Modified: cfe/branches/Apple/Dib/test/CodeGen/attributes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/CodeGen/attributes.c?rev=73444&r1=73443&r2=73444&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/CodeGen/attributes.c (original)
+++ cfe/branches/Apple/Dib/test/CodeGen/attributes.c Mon Jun 15 18:39:14 2009
@@ -14,7 +14,7 @@
 // RUN: grep '@t13 =.*section "SECT"' %t &&
 // RUN: grep '@t14.x =.*section "SECT"' %t
 // RUN: grep 'declare extern_weak i32 @t15()' %t &&
-// RUN: grep '@t16 = extern_weak global i32' %t
+// RUN: grep '@t16 = extern_weak global i32' %t &&
 
 void t1() __attribute__((noreturn));
 void t1() {}
@@ -56,4 +56,14 @@
   return t15() + t16;
 }
 
+// RUN: grep '@t18 = global i[0-9]* 1, align .*' %t &&
+extern int t18 __attribute__((weak_import));
+int t18 = 1;
+
+// RUN: grep 'define i[0-9]* @t19() nounwind {' %t &&
+extern int t19(void) __attribute__((weak_import));
+int t19(void) {
+  return 10;
+}
 
+// RUN: true





More information about the llvm-branch-commits mailing list