[lld] r302067 - Revert r301897, "ELF: Set symbol binding to STB_GLOBAL when undefining symbols during LTO."

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 12:23:30 PDT 2017


Author: pcc
Date: Wed May  3 14:23:30 2017
New Revision: 302067

URL: http://llvm.org/viewvc/llvm-project?rev=302067&view=rev
Log:
Revert r301897, "ELF: Set symbol binding to STB_GLOBAL when undefining symbols during LTO."

It doesn't matter what binding we store in a non-UsedInRegularObj undefined
symbol because we should reset it when we see a real undefined symbol in
a combined LTO object. The fact that we weren't doing so before is a bug
(PR32899) which is now fixed.

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=302067&r1=302066&r2=302067&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Wed May  3 14:23:30 2017
@@ -105,11 +105,6 @@ BitcodeCompiler::~BitcodeCompiler() = de
 static void undefine(Symbol *S) {
   replaceBody<Undefined>(S, S->body()->getName(), /*IsLocal=*/false,
                          STV_DEFAULT, S->body()->Type, nullptr);
-  // It shouldn't normally matter what the binding is, but if a bug in the LTO
-  // implementation causes it to fail to provide a definition for a symbol,
-  // setting the binding to STB_GLOBAL will cause the linker to report an
-  // undefined symbol error, even if the definition was weak.
-  S->Binding = STB_GLOBAL;
 }
 
 void BitcodeCompiler::add(BitcodeFile &F) {




More information about the llvm-commits mailing list