Template static data members can have weak_odr linkage, not just

weak linkage.  Also, fix a problem where global weak variables
with non-trivial initializers were getting guard variables, or at
least were checking for them and then crashing.

llvm-svn: 129342
This commit is contained in:
John McCall
2011-04-12 01:46:54 +00:00
parent b4744a3f4d
commit a97f329869
9 changed files with 28 additions and 17 deletions

View File

@@ -1316,9 +1316,7 @@ CodeGenModule::GetLLVMLinkageVarDefinition(const VarDecl *D,
return llvm::GlobalVariable::WeakAnyLinkage;
} else if (Linkage == GVA_TemplateInstantiation ||
Linkage == GVA_ExplicitTemplateInstantiation)
// FIXME: It seems like we can provide more specific linkage here
// (LinkOnceODR, WeakODR).
return llvm::GlobalVariable::WeakAnyLinkage;
return llvm::GlobalVariable::WeakODRLinkage;
else if (!getLangOptions().CPlusPlus &&
((!CodeGenOpts.NoCommon && !D->getAttr<NoCommonAttr>()) ||
D->getAttr<CommonAttr>()) &&