[PATCH] D17120: ELF: Implement the correct semantics of .[cd]tors.

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 19:23:42 PST 2016


Bigcheese added a subscriber: Bigcheese.
Bigcheese requested changes to this revision.
Bigcheese added a reviewer: Bigcheese.
This revision now requires changes to proceed.

================
Comment at: ELF/OutputSections.cpp:797
@@ +796,3 @@
+// Returns true if S matches /crtbegin.?\.o$/.
+static bool isCrtbegin(StringRef S) {
+  if (S.endswith("crtbegin.o"))
----------------
You also need to check for crtend. Its .ctors sections need to go after other .ctors.N sections.

================
Comment at: test/ELF/ctors_dtors_priority.s:35
@@ -34,3 +34,3 @@
 // CHECK:      Contents of section .ctors:
 // CHECK-NEXT: 03020000 00000000 010405
 // CHECK:      Contents of section .dtors:
----------------
This should be: 

1, 4, 5, 3, 2

.ctors is evaluated from the end to the start.



http://reviews.llvm.org/D17120





More information about the llvm-commits mailing list