[PATCH] D35397: ELF: Exclude dead symbols from -Map output.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 17:21:46 PDT 2017


pcc created this revision.
Herald added a subscriber: emaste.

This was previously erroring out if one of the dead symbols was a
TLS symbol and we were able to discard all TLS sections.


https://reviews.llvm.org/D35397

Files:
  lld/ELF/MapFile.cpp
  lld/test/ELF/map-gc-sections.s


Index: lld/test/ELF/map-gc-sections.s
===================================================================
--- /dev/null
+++ lld/test/ELF/map-gc-sections.s
@@ -0,0 +1,10 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: ld.lld %t.o -o %t -Map=%t.map --gc-sections
+// FileCheck %s < %t.map
+
+.section .tbss,"awT", at nobits
+// CHECK-NOT: foo
+.globl foo
+foo:
+.align 8
+.long 0
Index: lld/ELF/MapFile.cpp
===================================================================
--- lld/ELF/MapFile.cpp
+++ lld/ELF/MapFile.cpp
@@ -55,7 +55,7 @@
     for (SymbolBody *B : File->getSymbols())
       if (B->File == File && !B->isSection())
         if (auto *Sym = dyn_cast<DefinedRegular>(B))
-          if (Sym->Section)
+          if (Sym->Section && Sym->Section->Live)
             V.push_back(Sym);
   return V;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35397.106566.patch
Type: text/x-patch
Size: 840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170714/c5ba2070/attachment.bin>


More information about the llvm-commits mailing list