[cfe-commits] r72967 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/attributes.c
Daniel Dunbar
daniel at zuster.org
Fri Jun 5 15:58:34 PDT 2009
Author: ddunbar
Date: Fri Jun 5 17:58:34 2009
New Revision: 72967
URL: http://llvm.org/viewvc/llvm-project?rev=72967&view=rev
Log:
weak_import should not make definitions have weak linkage.
- <rdar://problem/6948703> clang treats weak_import like weak
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGen/attributes.c
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=72967&r1=72966&r2=72967&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Jun 5 17:58:34 2009
@@ -298,7 +298,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
@@ -853,7 +853,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/trunk/test/CodeGen/attributes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attributes.c?rev=72967&r1=72966&r2=72967&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/attributes.c (original)
+++ cfe/trunk/test/CodeGen/attributes.c Fri Jun 5 17:58:34 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 cfe-commits
mailing list