[ELF] - Implemented --retain-symbols-file option
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 19 Dec 2016 18:00:52 +0000 (18:00 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 19 Dec 2016 18:00:52 +0000 (18:00 +0000)
commit2bb88ab5e0c2a980c5cd723f362bafd9e0a3e927
tree2ae9280dca05f90dd9513f886155d2a92c95d900
parent086c90b24a1da2acee9e058e5135a627cee2fe04
[ELF] - Implemented --retain-symbols-file option

--retain-symbols-file=filename
Retain only the symbols listed in the file filename, discarding all others.
filename is simply a flat file, with one symbol name per line. This option
is especially useful in environments (such as VxWorks) where a large global
symbol table is accumulated gradually, to conserve run-time memory.

Note: though documentation says "--retain-symbols-file does not discard
undefined symbols, or symbols needed for relocations.", both bfd and gold
do that, and this patch too, like testcase show.

Differential revision: https://reviews.llvm.org/D27716

llvm-svn: 290122
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/Options.td
lld/ELF/Writer.cpp
lld/test/ELF/retain-symbols-file.s [new file with mode: 0644]