[lld] r251068 - ELF2: Keep .eh_frame even if they are not live.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 14:42:05 PDT 2015


Author: ruiu
Date: Thu Oct 22 16:42:05 2015
New Revision: 251068

URL: http://llvm.org/viewvc/llvm-project?rev=251068&view=rev
Log:
ELF2: Keep .eh_frame even if they are not live.

.eh_frame sections need to be preserved if they refer to live sections.
So the liveness relation is reverse for eh_frame sections. For now,
we simply preserve all .eh_frame sections. Thanks Rafael for pointing
this out. .jcr are kept for the same reason.

Modified:
    lld/trunk/ELF/MarkLive.cpp
    lld/trunk/test/elf2/gc-sections.s

Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=251068&r1=251067&r2=251068&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Thu Oct 22 16:42:05 2015
@@ -85,7 +85,8 @@ template <class ELFT> static bool isRese
     return true;
   default:
     StringRef S = Sec->getSectionName();
-    return S.startswith(".init") || S.startswith(".fini");
+    return S.startswith(".init") || S.startswith(".fini") ||
+           S.startswith(".jcr") || S == ".eh_frame";
   }
 }
 

Modified: lld/trunk/test/elf2/gc-sections.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/gc-sections.s?rev=251068&r1=251067&r2=251068&view=diff
==============================================================================
--- lld/trunk/test/elf2/gc-sections.s (original)
+++ lld/trunk/test/elf2/gc-sections.s Thu Oct 22 16:42:05 2015
@@ -9,6 +9,7 @@
 # RUN: llvm-readobj -sections -symbols %t2 | FileCheck -check-prefix=GC2 %s
 
 # NOGC: Name: .text
+# NOGC: Name: .eh_frame
 # NOGC: Name: .init
 # NOGC: Name: .fini
 # NOGC: Name: a
@@ -21,6 +22,7 @@
 # NOGC: Name: d
 
 # GC1:     Name: .text
+# GC1:     Name: .eh_frame
 # GC1:     Name: .init
 # GC1:     Name: .fini
 # GC1:     Name: a
@@ -33,6 +35,7 @@
 # GC1-NOT: Name: d
 
 # GC2:     Name: .text
+# GC2:     Name: .eh_frame
 # GC2:     Name: .init
 # GC2:     Name: .fini
 # GC2:     Name: a
@@ -82,3 +85,6 @@ y:
 
 .section .preinit_array,"aw", at preinit_array
   .quad 0
+
+.section .eh_frame,"aw", at progbits
+  .quad 0




More information about the llvm-commits mailing list