[lld] r264171 - [LTO] Only change linkage if we keep the symbol.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 10:59:07 PDT 2016


Author: davide
Date: Wed Mar 23 12:59:07 2016
New Revision: 264171

URL: http://llvm.org/viewvc/llvm-project?rev=264171&view=rev
Log:
[LTO] Only change linkage if we keep the symbol.

Modified:
    lld/trunk/ELF/LTO.cpp

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=264171&r1=264170&r2=264171&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Wed Mar 23 12:59:07 2016
@@ -83,13 +83,12 @@ void BitcodeCompiler::add(BitcodeFile &F
       continue;
     }
     if (!BitcodeFile::shouldSkip(Sym)) {
-
-      if (GV->getLinkage() == llvm::GlobalValue::LinkOnceODRLinkage)
-        GV->setLinkage(GlobalValue::WeakODRLinkage);
-
       if (SymbolBody *B = Bodies[BodyIndex++])
-        if (&B->repl() == B && isa<DefinedBitcode>(B))
+        if (&B->repl() == B && isa<DefinedBitcode>(B)) {
+          if (GV->getLinkage() == llvm::GlobalValue::LinkOnceODRLinkage)
+            GV->setLinkage(GlobalValue::WeakODRLinkage);
           Keep.push_back(GV);
+        }
     }
   }
 




More information about the llvm-commits mailing list