Mark .eh_frame sections as live by default. NFC.
This change eliminates a string comparison from the
garbage collector.
llvm-svn: 256378
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index f28c87c..71078cf 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -253,7 +253,12 @@
template <class ELFT>
EHInputSection<ELFT>::EHInputSection(ObjectFile<ELFT> *F,
const Elf_Shdr *Header)
- : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) {}
+ : SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) {
+ // Mark .eh_frame sections as live by default because there are
+ // usually no relocations that point to .eh_frames. Otherwise,
+ // the garbage collector would drop all .eh_frame sections.
+ this->Live = true;
+}
template <class ELFT>
bool EHInputSection<ELFT>::classof(const InputSectionBase<ELFT> *S) {