diff options
author | Chris Lattner <sabre@nondot.org> | 2005-02-12 19:20:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-02-12 19:20:28 +0000 |
commit | 16277c17758ad9a5d9c7884ca5a1aacfdba1464f (patch) | |
tree | a507f2de3bf1324093b77c4bc1d1d0f230afa9d5 /llvm/lib/Linker/LinkModules.cpp | |
parent | 36f3eb82a11e4701c04b6962344459e515a38291 (diff) | |
download | bcm5719-llvm-16277c17758ad9a5d9c7884ca5a1aacfdba1464f.tar.gz bcm5719-llvm-16277c17758ad9a5d9c7884ca5a1aacfdba1464f.zip |
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
llvm-svn: 20135
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index ae80cd7da39..1d9911d669d 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/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); |