summaryrefslogtreecommitdiff
path: root/lib/Linker
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-03-07 18:32:18 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-03-07 18:32:18 +0000
commite20c814518e3322f5bf5f83e9ca42bd6bdd40745 (patch)
tree4debd2667ee05332e7817cdb7463d35f6609996e /lib/Linker
parente707216cb9dc36d335a28ecb735a94e3a315b067 (diff)
downloadllvm-e20c814518e3322f5bf5f83e9ca42bd6bdd40745.tar.gz
llvm-e20c814518e3322f5bf5f83e9ca42bd6bdd40745.tar.bz2
llvm-e20c814518e3322f5bf5f83e9ca42bd6bdd40745.tar.xz
Small cleanup: propagate thread-localness via generic routine.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r--lib/Linker/LinkModules.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 0d8ba4e3e8..eed36c1674 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -361,6 +361,9 @@ static void CopyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
DestF->setParamAttrs(SrcF->getParamAttrs());
if (SrcF->hasCollector())
DestF->setCollector(SrcF->getCollector());
+ } else if (const GlobalVariable *SrcVar = dyn_cast<GlobalVariable>(SrcGV)) {
+ GlobalVariable *DestVar = cast<GlobalVariable>(DestGV);
+ DestVar->setThreadLocal(SrcVar->isThreadLocal());
}
}
@@ -488,7 +491,7 @@ static bool LinkGlobals(Module *Dest, Module *Src,
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
SGV->isConstant(), SGV->getLinkage(), /*init*/0,
- SGV->getName(), Dest, SGV->isThreadLocal());
+ SGV->getName(), Dest);
// Propagate alignment, visibility and section info.
CopyGVAttributes(NewDGV, SGV);
@@ -511,9 +514,9 @@ static bool LinkGlobals(Module *Dest, Module *Src,
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
SGV->isConstant(), SGV->getLinkage(), /*init*/0,
- "", Dest, SGV->isThreadLocal());
+ "", Dest);
- // Propagate alignment, section and visibility info.
+ // Propagate alignment, section and visibility info.
NewDGV->setAlignment(DGV->getAlignment());
CopyGVAttributes(NewDGV, SGV);
@@ -523,17 +526,17 @@ static bool LinkGlobals(Module *Dest, Module *Src,
// Keep track that this is an appending variable...
AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
} else {
+ // Otherwise, perform the mapping as instructed by GetLinkageResult.
+
// Propagate alignment, section, and visibility info.
CopyGVAttributes(DGV, SGV);
- // Otherwise, perform the mapping as instructed by GetLinkageResult. If
- // the types don't match, and if we are to link from the source, nuke DGV
- // and create a new one of the appropriate type.
+ // If the types don't match, and if we are to link from the source, nuke
+ // DGV and create a new one of the appropriate type.
if (SGV->getType() != DGV->getType() && LinkFromSrc) {
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
DGV->isConstant(), DGV->getLinkage());
- NewDGV->setThreadLocal(DGV->isThreadLocal());
CopyGVAttributes(NewDGV, DGV);
Dest->getGlobalList().insert(DGV, NewDGV);
DGV->replaceAllUsesWith(