[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:32:34 PDT 2017


This revision was automatically updated to reflect the committed changes.
pcc marked an inline comment as done.
Closed by commit rL307984: ELF: Exclude dead symbols from -Map output. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D35397?vs=106566&id=106568#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35397

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


Index: lld/trunk/ELF/MapFile.cpp
===================================================================
--- lld/trunk/ELF/MapFile.cpp
+++ lld/trunk/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;
 }
Index: lld/trunk/test/ELF/map-gc-sections.s
===================================================================
--- lld/trunk/test/ELF/map-gc-sections.s
+++ lld/trunk/test/ELF/map-gc-sections.s
@@ -0,0 +1,9 @@
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: ld.lld %t.o -o %t -Map=- --gc-sections | FileCheck %s
+
+.section .tbss,"awT", at nobits
+// CHECK-NOT: foo
+.globl foo
+foo:
+.align 8
+.long 0


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


More information about the llvm-commits mailing list