From: Eli Friedman Date: Thu, 29 May 2008 11:03:17 +0000 (+0000) Subject: Tentative declarations are supposed to have common linkage, not weak. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a07b76419a03f126c22949dce2e546ba4df0e415;p=clang Tentative declarations are supposed to have common linkage, not weak. This change makes clang generate the same thing as llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51674 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 525c13fc96..0b7d30ac50 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -500,7 +500,7 @@ void CodeGenModule::EmitGlobalVarInit(const VarDecl *D) { assert(0 && "Can't have auto or register globals"); case VarDecl::None: if (!D->getInit()) - GV->setLinkage(llvm::GlobalVariable::WeakLinkage); + GV->setLinkage(llvm::GlobalVariable::CommonLinkage); break; case VarDecl::Extern: case VarDecl::PrivateExtern: diff --git a/test/CodeGen/weak-global.c b/test/CodeGen/weak-global.c index 86e551c1ea..d19dd61291 100644 --- a/test/CodeGen/weak-global.c +++ b/test/CodeGen/weak-global.c @@ -1,3 +1,3 @@ -// RUN: clang -emit-llvm < %s | grep weak +// RUN: clang -emit-llvm < %s | grep common int i;