[lld] 38e6361 - [ELF] Simplify includeInSymtab. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 5 11:18:14 PST 2022


Author: Fangrui Song
Date: 2022-02-05T11:18:08-08:00
New Revision: 38e6361d847e81b95638003eeab804d496260bf4

URL: https://github.com/llvm/llvm-project/commit/38e6361d847e81b95638003eeab804d496260bf4
DIFF: https://github.com/llvm/llvm-project/commit/38e6361d847e81b95638003eeab804d496260bf4.diff

LOG: [ELF] Simplify includeInSymtab. NFC

Added: 
    

Modified: 
    lld/ELF/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 0bcf3dec2509..a8a08da3b09c 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -675,14 +675,9 @@ static bool includeInSymtab(const Symbol &b) {
     if (!sec)
       return true;
 
-    // Exclude symbols pointing to garbage-collected sections.
-    if (isa<InputSectionBase>(sec) && !sec->isLive())
-      return false;
-
     if (auto *s = dyn_cast<MergeInputSection>(sec))
-      if (!s->getSectionPiece(d->value)->live)
-        return false;
-    return true;
+      return s->getSectionPiece(d->value)->live;
+    return sec->isLive();
   }
   return b.used || !config->gcSections;
 }


        


More information about the llvm-commits mailing list