summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Linker.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
commit693e393feee26c27976f8ca4262678f390680563 (patch)
tree62a8dc99312cac99c0ea9df3c75268a18161b694 /llvm/lib/Transforms/Utils/Linker.cpp
parent2a6802ff4151122632215d45cbbaaa0d1eb3acf3 (diff)
downloadbcm5719-llvm-693e393feee26c27976f8ca4262678f390680563.tar.gz
bcm5719-llvm-693e393feee26c27976f8ca4262678f390680563.zip
Fix PR245: Linking weak and strong global variables is dependent on link order
llvm-svn: 11565
Diffstat (limited to 'llvm/lib/Transforms/Utils/Linker.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Linker.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Linker.cpp b/llvm/lib/Transforms/Utils/Linker.cpp
index aa7720ece35..529fb771489 100644
--- a/llvm/lib/Transforms/Utils/Linker.cpp
+++ b/llvm/lib/Transforms/Utils/Linker.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 {
OpenPOWER on IntegriCloud