[PATCH] D28951: [ELF] - Linkerscripts: ignore CONSTRUCTORS in output section declaration.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 09:53:50 PST 2017


grimar updated this revision to Diff 85152.
grimar added a comment.

- Addressed review comments.


https://reviews.llvm.org/D28951

Files:
  ELF/LinkerScript.cpp
  test/ELF/linkerscript/constructor.s


Index: test/ELF/linkerscript/constructor.s
===================================================================
--- test/ELF/linkerscript/constructor.s
+++ test/ELF/linkerscript/constructor.s
@@ -0,0 +1,12 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "SECTIONS { foo : { *(.foo) CONSTRUCTORS } }" > %t.script
+
+# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
+# CHECK:      Sections:
+# CHECK-NEXT: Idx Name          Size
+# CHECK-NEXT:   0               00000000
+# CHECK-NEXT:   1 foo           00000001
+
+.section foo, "a"
+.byte 0
Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -1449,6 +1449,9 @@
     } else if (Tok == "ASSERT") {
       Cmd->Commands.emplace_back(new AssertCommand(readAssert()));
       expect(";");
+    } else if (Tok == "CONSTRUCTORS") {
+      // The GNU linkers uses CONSTRUCTORS for the a.out object,
+      // it is ignored for ELF.
     } else if (Tok == "FILL") {
       Cmd->Filler = readFill();
     } else if (Tok == "SORT") {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28951.85152.patch
Type: text/x-patch
Size: 1132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170120/27d64786/attachment.bin>


More information about the llvm-commits mailing list