If weak GlobalVariable was bitcast'ed to different type during linking
authorAnton Korobeynikov <asl@math.spbu.ru>
Tue, 6 May 2008 22:52:54 +0000 (22:52 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Tue, 6 May 2008 22:52:54 +0000 (22:52 +0000)
we will need to strip all casts for intializer lookup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50776 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Linker/LinkModules.cpp

index a82b266bbdb09e7b2e8876219632add8c4a37136..ddc9081d654cab7f210a4d890d01dd426550d730 100644 (file)
@@ -758,7 +758,7 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src,
       Constant *SInit =
         cast<Constant>(RemapOperand(SGV->getInitializer(), ValueMap));
 
-      GlobalVariable *DGV = cast<GlobalVariable>(ValueMap[SGV]);
+      GlobalVariable *DGV = cast<GlobalVariable>(StripPointerCasts(ValueMap[SGV]));
       if (DGV->hasInitializer()) {
         if (SGV->hasExternalLinkage()) {
           if (DGV->getInitializer() != SInit)