diff options
author | Peter Smith <peter.smith@linaro.org> | 2018-05-15 08:57:21 +0000 |
---|---|---|
committer | Peter Smith <peter.smith@linaro.org> | 2018-05-15 08:57:21 +0000 |
commit | dbef8cc67c9918334c22f03e23e2dfa84ade464b (patch) | |
tree | b5fdfd07c8936ada276396dbbcbfb7284194b919 /lld/ELF/InputSection.h | |
parent | 559d1e34df710a0c88dc775b014413c8f80804f7 (diff) | |
download | bcm5719-llvm-dbef8cc67c9918334c22f03e23e2dfa84ade464b.tar.gz bcm5719-llvm-dbef8cc67c9918334c22f03e23e2dfa84ade464b.zip |
[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
Diffstat (limited to 'lld/ELF/InputSection.h')
-rw-r--r-- | lld/ELF/InputSection.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index 50ca557a634..bc70baf8ba3 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -61,6 +61,9 @@ public: unsigned Bss : 1; + // Set for sections that should not be folded by ICF. + unsigned KeepUnique : 1; + // These corresponds to the fields in Elf_Shdr. uint32_t Alignment; uint64_t Flags; @@ -85,8 +88,8 @@ protected: uint64_t Entsize, uint64_t Alignment, uint32_t Type, uint32_t Info, uint32_t Link) : Name(Name), Repl(this), SectionKind(SectionKind), Live(false), - Bss(false), Alignment(Alignment), Flags(Flags), Entsize(Entsize), - Type(Type), Link(Link), Info(Info) {} + Bss(false), KeepUnique(false), Alignment(Alignment), Flags(Flags), + Entsize(Entsize), Type(Type), Link(Link), Info(Info) {} }; // This corresponds to a section of an input file. |