[ELF] Implement --keep-unique option
authorPeter Smith <peter.smith@linaro.org>
Tue, 15 May 2018 08:57:21 +0000 (08:57 +0000)
committerPeter Smith <peter.smith@linaro.org>
Tue, 15 May 2018 08:57:21 +0000 (08:57 +0000)
commitdbef8cc67c9918334c22f03e23e2dfa84ade464b
treeb5fdfd07c8936ada276396dbbcbfb7284194b919
parent559d1e34df710a0c88dc775b014413c8f80804f7
[ELF] Implement --keep-unique option

The --keep-unique <symbol> option is taken from gold. The intention is that
<symbol> will be prevented from being folded by ICF. Although not
specifically mentioned in the documentation <symbol> only matches
global symbols, with a warning if the symbol is not found.

The implementation finds the Section defining <symbol> and removes it from
the set of sections considered for ICF.

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

llvm-svn: 332332
lld/ELF/Driver.cpp
lld/ELF/ICF.cpp
lld/ELF/InputSection.h
lld/ELF/Options.td
lld/test/ELF/icf-keep-unique.s [new file with mode: 0644]