Mark .eh_frame sections as live by default. NFC.

This change eliminates a string comparison from the
garbage collector.

llvm-svn: 256378
This commit is contained in:
Rui Ueyama 2015-12-24 10:08:54 +00:00
parent b42d9a5f06
commit da735325fa
2 changed files with 6 additions and 5 deletions

View File

@ -253,7 +253,12 @@ SplitInputSection<ELFT>::SplitInputSection(
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) {

View File

@ -120,10 +120,6 @@ template <class ELFT> void lld::elf2::markLive(SymbolTable<ELFT> *Symtab) {
continue;
if (isReserved(Sec))
Enqueue(Sec);
else if (Sec->getSectionName() == ".eh_frame")
// .eh_frame is special. It should be marked live so that we don't
// drop it, but it should not keep any section alive.
Sec->Live = true;
}
}