Set the unnamed_addr only when we're creating a new GV in the dest module.
authorBill Wendling <isanbard@gmail.com>
Tue, 29 Mar 2011 23:31:06 +0000 (23:31 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 29 Mar 2011 23:31:06 +0000 (23:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128507 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Linker/LinkModules.cpp

index 5aa06abdd989e9950fd18eb6aa6aedcbee3394d5..f372db2403c91a3435e1fe3fe3d0d9bd8d31d0ea 100644 (file)
@@ -505,6 +505,7 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
                            SGV->getType()->getAddressSpace());
       // Propagate alignment, visibility and section info.
       CopyGVAttributes(NewDGV, SGV);
+      NewDGV->setUnnamedAddr(SGV->hasUnnamedAddr());
 
       // If the LLVM runtime renamed the global, but it is an externally visible
       // symbol, DGV must be an existing global with internal linkage.  Rename