[ELF] Do not keep symbols if they referenced only from discarded sections.
authorIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 27 Nov 2017 05:51:10 +0000 (05:51 +0000)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 27 Nov 2017 05:51:10 +0000 (05:51 +0000)
commit40007586fcde4f77a4f09fc6b916fba45bb55d84
treebff5a68d4a6add98c8c9b88725a18f18c9a1fdad
parent2ce208d8e2a7a403ffbf66bbf8811d55495341d3
[ELF] Do not keep symbols if they referenced only from discarded sections.

This patch also ensures that in case of "--as-needed" is used,
DT_NEEDED entries are not created if they are required only by
these eliminated symbols.

Differential Revision: https://reviews.llvm.org/D38790

llvm-svn: 319008
lld/ELF/MarkLive.cpp
lld/ELF/SymbolTable.cpp
lld/ELF/Symbols.h
lld/ELF/Writer.cpp
lld/test/ELF/Inputs/gc-sections-shared2.s [new file with mode: 0644]
lld/test/ELF/gc-collect-undefined.s [new file with mode: 0644]
lld/test/ELF/gc-sections-shared.s