mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Allow unnamed_addr on declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123529 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -352,8 +352,6 @@ static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
|
||||
unsigned Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment());
|
||||
DestGV->copyAttributesFrom(SrcGV);
|
||||
DestGV->setAlignment(Alignment);
|
||||
if (SrcGV->hasUnnamedAddr())
|
||||
DestGV->setUnnamedAddr(true);
|
||||
}
|
||||
|
||||
/// GetLinkageResult - This analyzes the two global values and determines what
|
||||
@@ -521,6 +519,8 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
||||
continue;
|
||||
}
|
||||
|
||||
bool HasUnnamedAddr = SGV->hasUnnamedAddr() && DGV->hasUnnamedAddr();
|
||||
|
||||
// If the visibilities of the symbols disagree and the destination is a
|
||||
// prototype, take the visibility of its input.
|
||||
if (DGV->isDeclaration())
|
||||
@@ -565,6 +565,9 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
||||
DGV->getName(), 0, false,
|
||||
SGV->getType()->getAddressSpace());
|
||||
|
||||
// Set the unnamed_addr.
|
||||
NewDGV->setUnnamedAddr(HasUnnamedAddr);
|
||||
|
||||
// Propagate alignment, section, and visibility info.
|
||||
CopyGVAttributes(NewDGV, SGV);
|
||||
DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV,
|
||||
@@ -609,8 +612,9 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
||||
"': symbol multiple defined");
|
||||
}
|
||||
|
||||
// Set calculated linkage
|
||||
// Set calculated linkage and unnamed_addr
|
||||
DGV->setLinkage(NewLinkage);
|
||||
DGV->setUnnamedAddr(HasUnnamedAddr);
|
||||
|
||||
// Make sure to remember this mapping...
|
||||
ValueMap[SGV] = ConstantExpr::getBitCast(DGV, SGV->getType());
|
||||
|
Reference in New Issue
Block a user