aboutsummaryrefslogtreecommitdiff
path: root/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-12 19:20:28 +0000
committerChris Lattner <sabre@nondot.org>2005-02-12 19:20:28 +0000
commite6f8c5a71682ffcc33d3c83a40821ded8f2c8033 (patch)
tree8858ba701e93a9adfe2e77f1711fa479cff172c7 /lib/Linker/LinkModules.cpp
parent5b7dcaa96be8da5c2fd5311994c759dc6db7c8c4 (diff)
Allow globals to be of different const'nesses when we link.
This finally resolves PR502, PR450, and test/Regression/Linker/2005-02-12-ConstantGlobals{,-2}.ll correctly git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r--lib/Linker/LinkModules.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index ae80cd7da3..1d9911d669 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -517,18 +517,12 @@ static bool LinkGlobals(Module *Dest, Module *Src,
DGV->setLinkage(NewLinkage);
if (LinkFromSrc) {
- if (DGV->isConstant() && !SGV->isConstant())
- return Error(Err, "Global Variable Collision on global '" +
- SGV->getName() + "': variables differ in const'ness");
// Inherit const as appropriate
- if (SGV->isConstant()) DGV->setConstant(true);
+ DGV->setConstant(SGV->isConstant());
DGV->setInitializer(0);
} else {
if (SGV->isConstant() && !DGV->isConstant()) {
- if (!DGV->isExternal())
- return Error(Err, "Global Variable Collision on global '" +
- SGV->getName() + "': variables differ in const'ness");
- else
+ if (DGV->isExternal())
DGV->setConstant(true);
}
SGV->setLinkage(GlobalValue::ExternalLinkage);