From 149a3153694f8b75f8f2f1754575e6a52b45214a Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Tue, 6 May 2008 22:52:54 +0000 Subject: [PATCH] If weak GlobalVariable was bitcast'ed to different type during linking 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index a82b266bbdb..ddc9081d654 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -758,7 +758,7 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src, Constant *SInit = cast(RemapOperand(SGV->getInitializer(), ValueMap)); - GlobalVariable *DGV = cast(ValueMap[SGV]); + GlobalVariable *DGV = cast(StripPointerCasts(ValueMap[SGV])); if (DGV->hasInitializer()) { if (SGV->hasExternalLinkage()) { if (DGV->getInitializer() != SInit)