[lld] r307984 - ELF: Exclude dead symbols from -Map output.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 13 17:31:56 PDT 2017
Author: pcc
Date: Thu Jul 13 17:31:56 2017
New Revision: 307984
URL: http://llvm.org/viewvc/llvm-project?rev=307984&view=rev
Log:
ELF: Exclude dead symbols from -Map output.
This was previously erroring out if one of the dead symbols was a
TLS symbol and we were able to discard all TLS sections.
Differential Revision: https://reviews.llvm.org/D35397
Added:
lld/trunk/test/ELF/map-gc-sections.s
Modified:
lld/trunk/ELF/MapFile.cpp
Modified: lld/trunk/ELF/MapFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=307984&r1=307983&r2=307984&view=diff
==============================================================================
--- lld/trunk/ELF/MapFile.cpp (original)
+++ lld/trunk/ELF/MapFile.cpp Thu Jul 13 17:31:56 2017
@@ -55,7 +55,7 @@ template <class ELFT> std::vector<Define
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;
}
Added: lld/trunk/test/ELF/map-gc-sections.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/map-gc-sections.s?rev=307984&view=auto
==============================================================================
--- lld/trunk/test/ELF/map-gc-sections.s (added)
+++ lld/trunk/test/ELF/map-gc-sections.s Thu Jul 13 17:31:56 2017
@@ -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
More information about the llvm-commits
mailing list