[ELF] - Eliminate dead code from shouldKeepInSymtab. NFC.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 29 Jun 2018 13:34:05 +0000 (13:34 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 29 Jun 2018 13:34:05 +0000 (13:34 +0000)
shouldKeepInSymtab is called from copyLocalSymbols:
https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L574

The pre-condition is that symbol should be Defined:
https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L572

And its section is Live:
https://github.com/llvm-mirror/lld/blob/master/ELF/Writer.cpp#L548

InputSection::Discarded section can never be Live. And hence I believe
check I removed in this patch is excessive.

llvm-svn: 335973

lld/ELF/Writer.cpp

index 759ac3d..bc3f0be 100644 (file)
@@ -513,9 +513,6 @@ static bool shouldKeepInSymtab(SectionBase *Sec, StringRef SymName,
   if (B.isSection())
     return false;
 
-  // If sym references a section in a discarded group, don't keep it.
-  if (Sec == &InputSection::Discarded)
-    return false;
 
   if (Config->Discard == DiscardPolicy::None)
     return true;