[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 12 11:20:41 PST 2005



Changes in directory llvm/lib/Linker:

LinkModules.cpp updated: 1.101 -> 1.102
---
Log message:

Allow globals to be of different const'nesses when we link. 
This finally resolves PR502: http://llvm.cs.uiuc.edu/PR502 , PR450: http://llvm.cs.uiuc.edu/PR450 , 
and test/Regression/Linker/2005-02-12-ConstantGlobals{,-2}.ll correctly



---
Diffs of the changes:  (+2 -8)

 LinkModules.cpp |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)


Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.101 llvm/lib/Linker/LinkModules.cpp:1.102
--- llvm/lib/Linker/LinkModules.cpp:1.101	Sun Dec 12 21:00:16 2004
+++ llvm/lib/Linker/LinkModules.cpp	Sat Feb 12 13:20:28 2005
@@ -517,18 +517,12 @@
       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);






More information about the llvm-commits mailing list