[lld] r256378 - Mark .eh_frame sections as live by default. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 24 02:08:54 PST 2015


Author: ruiu
Date: Thu Dec 24 04:08:54 2015
New Revision: 256378

URL: http://llvm.org/viewvc/llvm-project?rev=256378&view=rev
Log:
Mark .eh_frame sections as live by default. NFC.

This change eliminates a string comparison from the
garbage collector.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/MarkLive.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=256378&r1=256377&r2=256378&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Dec 24 04:08:54 2015
@@ -253,7 +253,12 @@ SplitInputSection<ELFT>::SplitInputSecti
 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) {

Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=256378&r1=256377&r2=256378&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Thu Dec 24 04:08:54 2015
@@ -120,10 +120,6 @@ template <class ELFT> void lld::elf2::ma
         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;
     }
   }
 




More information about the llvm-commits mailing list