From f20a55fcfd033e7a171bcdefa7e92fc758975fe4 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Wed, 23 Mar 2016 17:59:07 +0000 Subject: [PATCH] [LTO] Only change linkage if we keep the symbol. llvm-svn: 264171 --- lld/ELF/LTO.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index 6d2be05..ab97079 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -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(B)) + if (&B->repl() == B && isa(B)) { + if (GV->getLinkage() == llvm::GlobalValue::LinkOnceODRLinkage) + GV->setLinkage(GlobalValue::WeakODRLinkage); Keep.push_back(GV); + } } } -- 2.7.4