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:
@@ -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>()) &&
|
||||
|
||||
Reference in New Issue
Block a user