[PATCH] D15767: [lld/ELF] Don't reclaim .ctors/.dtors

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 24 01:55:38 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL256373: [ELF] Don't reclaim .ctors/.dtors sections. (authored by davide).

Changed prior to commit:
  http://reviews.llvm.org/D15767?vs=43588&id=43590#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15767

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

Index: lld/trunk/test/ELF/gc-sections.s
===================================================================
--- lld/trunk/test/ELF/gc-sections.s
+++ lld/trunk/test/ELF/gc-sections.s
@@ -10,6 +10,8 @@
 
 # NOGC: Name: .eh_frame
 # NOGC: Name: .text
+# NOGC: Name: .ctors
+# NOGC: Name: .dtors
 # NOGC: Name: .init
 # NOGC: Name: .fini
 # NOGC: Name: a
@@ -23,6 +25,8 @@
 
 # GC1:     Name: .eh_frame
 # GC1:     Name: .text
+# GC1:     Name: .ctors
+# GC1:     Name: .dtors
 # GC1:     Name: .init
 # GC1:     Name: .fini
 # GC1:     Name: a
@@ -36,6 +40,8 @@
 
 # GC2:     Name: .eh_frame
 # GC2:     Name: .text
+# GC2:     Name: .ctors
+# GC2:     Name: .dtors
 # GC2:     Name: .init
 # GC2:     Name: .fini
 # GC2:     Name: a
@@ -77,6 +83,12 @@
 y:
   call x
 
+.section .ctors,"aw", at progbits
+  .quad 0
+
+.section .dtors,"aw", at progbits
+  .quad 0
+
 .section .init,"aw", at init_array
   .quad 0
 
Index: lld/trunk/ELF/MarkLive.cpp
===================================================================
--- lld/trunk/ELF/MarkLive.cpp
+++ lld/trunk/ELF/MarkLive.cpp
@@ -70,7 +70,8 @@
     return true;
   default:
     StringRef S = Sec->getSectionName();
-    return S.startswith(".init") || S.startswith(".fini") ||
+    return S.startswith(".ctors") || S.startswith(".dtors") ||
+           S.startswith(".init") || S.startswith(".fini") ||
            S.startswith(".jcr");
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15767.43590.patch
Type: text/x-patch
Size: 1386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151224/06e11dec/attachment.bin>


More information about the llvm-commits mailing list