aboutsummaryrefslogtreecommitdiff
path: root/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-17 21:56:04 +0000
committerChris Lattner <sabre@nondot.org>2004-02-17 21:56:04 +0000
commit57cb9883aa4c82357594d4186858f175135be3b1 (patch)
tree7d987714faac9c0bb0844005c7f88f19da887f97 /lib/Linker/LinkModules.cpp
parent28a631d37e073befd1099cd713d47a31a4b40879 (diff)
Fix PR245: Linking weak and strong global variables is dependent on link order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r--lib/Linker/LinkModules.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index aa7720ece3..529fb77148 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -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 {