Don't set unnamed_addr in CreateRuntimeVariable.

This was fairly broken. For example,

@__dso_handle would or would not get an unnamed_addr depending on how many
global destructors were used in a translation unit.

The consensus was that not every runtime variable is unnamed_addr and that
__dso_handle handle should not be, so just don't add unnamed_addr in
CreateRuntimeVariable.

llvm-svn: 209484
This commit is contained in:
Rafael Espindola
2014-05-22 23:33:27 +00:00
parent 6a0bc99542
commit b73c973d3b
3 changed files with 4 additions and 10 deletions

View File

@@ -1533,8 +1533,7 @@ static bool isVarDeclInlineInitializedStaticDataMember(const VarDecl *VD) {
llvm::Constant *
CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
llvm::PointerType *Ty,
const VarDecl *D,
bool UnnamedAddr) {
const VarDecl *D) {
// Lookup the entry, lazily creating it if necessary.
llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
if (Entry) {
@@ -1543,9 +1542,6 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
Entry->setLinkage(llvm::Function::ExternalLinkage);
}
if (UnnamedAddr)
Entry->setUnnamedAddr(true);
if (Entry->getType() == Ty)
return Entry;
@@ -1671,8 +1667,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D,
llvm::Constant *
CodeGenModule::CreateRuntimeVariable(llvm::Type *Ty,
StringRef Name) {
return GetOrCreateLLVMGlobal(Name, llvm::PointerType::getUnqual(Ty), nullptr,
true);
return GetOrCreateLLVMGlobal(Name, llvm::PointerType::getUnqual(Ty), nullptr);
}
void CodeGenModule::EmitTentativeDefinition(const VarDecl *D) {