Fix PR245: Linking weak and strong global variables is dependent on link order

llvm-svn: 11565
This commit is contained in:
Chris Lattner 2004-02-17 21:56:04 +00:00
parent d9e1a49650
commit 4fa2e7a67f

View File

@ -566,7 +566,6 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src,
GlobalVariable *DGV = cast<GlobalVariable>(ValueMap[SGV]);
if (DGV->hasInitializer()) {
assert(SGV->getLinkage() == DGV->getLinkage());
if (SGV->hasExternalLinkage()) {
if (DGV->getInitializer() != SInit)
return Error(Err, "Global Variable Collision on '" +
@ -575,6 +574,9 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src,
} else if (DGV->hasLinkOnceLinkage() || DGV->hasWeakLinkage()) {
// Nothing is required, mapped values will take the new global
// automatically.
} else if (SGV->hasLinkOnceLinkage() || SGV->hasWeakLinkage()) {
// Nothing is required, mapped values will take the new global
// automatically.
} else if (DGV->hasAppendingLinkage()) {
assert(0 && "Appending linkage unimplemented!");
} else {