diff options
| author | Rui Ueyama <ruiu@google.com> | 2015-12-24 10:08:54 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2015-12-24 10:08:54 +0000 |
| commit | da735325fa43a0c375bcc3544f2cb80e2b86e423 (patch) | |
| tree | c91b7bafd300723dbb37f7430dffcd91d42076cc | |
| parent | b42d9a5f0607e8407991bbcd63368232c0350494 (diff) | |
| download | bcm5719-llvm-da735325fa43a0c375bcc3544f2cb80e2b86e423.tar.gz bcm5719-llvm-da735325fa43a0c375bcc3544f2cb80e2b86e423.zip | |
Mark .eh_frame sections as live by default. NFC.
This change eliminates a string comparison from the
garbage collector.
llvm-svn: 256378
| -rw-r--r-- | lld/ELF/InputSection.cpp | 7 | ||||
| -rw-r--r-- | lld/ELF/MarkLive.cpp | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index f28c87ce4af..71078cfb6db 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -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) { diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp index c44220a981a..88ec4f634d9 100644 --- a/lld/ELF/MarkLive.cpp +++ b/lld/ELF/MarkLive.cpp @@ -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; } } |

