diff options
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 820f3acace..0507c5acc9 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -919,9 +919,10 @@ bool ModuleLinker::linkAliasProto(GlobalAlias *SGA) { // If there is no linkage to be performed or we're linking from the source, // bring over SGA. - GlobalAlias *NewDA = new GlobalAlias(TypeMap.get(SGA->getType()), - SGA->getLinkage(), SGA->getName(), - /*aliasee*/nullptr, DstM); + auto *PTy = cast<PointerType>(TypeMap.get(SGA->getType())); + GlobalAlias *NewDA = + new GlobalAlias(PTy->getElementType(), SGA->getLinkage(), SGA->getName(), + /*aliasee*/ nullptr, DstM, PTy->getAddressSpace()); copyGVAttributes(NewDA, SGA); if (NewVisibility) NewDA->setVisibility(*NewVisibility); |