summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-27 03:10:24 +0000
committerChris Lattner <sabre@nondot.org>2008-06-27 03:10:24 +0000
commitb32a9ef00f2ae666ad861b9524bb4a4910e0156e (patch)
treebe50e317e2262f3d7b81c84e27624eb2508985f9 /llvm/lib/Linker
parent54c3377d0150742e37c9dc67b9bade076f2a79e7 (diff)
downloadbcm5719-llvm-b32a9ef00f2ae666ad861b9524bb4a4910e0156e.tar.gz
bcm5719-llvm-b32a9ef00f2ae666ad861b9524bb4a4910e0156e.zip
when linking globals, make sure to preserve the address space of the global.
llvm-svn: 52810
Diffstat (limited to 'llvm/lib/Linker')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 1609c6c0e09..e02f7fe44c6 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -575,7 +575,8 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
SGV->isConstant(), SGV->getLinkage(), /*init*/0,
- SGV->getName(), Dest);
+ SGV->getName(), Dest, false,
+ SGV->getType()->getAddressSpace());
// Propagate alignment, visibility and section info.
CopyGVAttributes(NewDGV, SGV);
@@ -599,7 +600,8 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
SGV->isConstant(), SGV->getLinkage(), /*init*/0,
- "", Dest);
+ "", Dest, false,
+ SGV->getType()->getAddressSpace());
// Set alignment allowing CopyGVAttributes merge it with alignment of SGV.
NewDGV->setAlignment(DGV->getAlignment());
@@ -634,7 +636,8 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
GlobalVariable *NewDGV =
new GlobalVariable(SGV->getType()->getElementType(),
DGVar->isConstant(), DGVar->getLinkage(),
- /*init*/0, DGVar->getName(), Dest);
+ /*init*/0, DGVar->getName(), Dest, false,
+ SGV->getType()->getAddressSpace());
CopyGVAttributes(NewDGV, DGVar);
DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV,
DGVar->getType()));
@@ -1166,7 +1169,8 @@ static bool LinkAppendingVars(Module *M,
// Create the new global variable...
GlobalVariable *NG =
new GlobalVariable(NewType, G1->isConstant(), G1->getLinkage(),
- /*init*/0, First->first, M, G1->isThreadLocal());
+ /*init*/0, First->first, M, G1->isThreadLocal(),
+ G1->getType()->getAddressSpace());
// Propagate alignment, visibility and section info.
CopyGVAttributes(NG, G1);
OpenPOWER on IntegriCloud