[PATCH] D13509: [ELF2] Add ENTRY command to the linker script

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 07:27:19 PDT 2015


ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM with nits.


================
Comment at: ELF/LinkerScript.cpp:41
@@ -40,2 +40,3 @@
   void readGroup();
+  void readEntry();
   void readOutput();
----------------
Sort.

================
Comment at: ELF/LinkerScript.cpp:53-56
@@ -51,4 +52,6 @@
     StringRef Tok = next();
     if (Tok == "GROUP") {
       readGroup();
+    } else if (Tok == "ENTRY") {
+      readEntry();
     } else if (Tok == "OUTPUT") {
----------------
Move ENTRY before GROUP to sort them.

================
Comment at: ELF/LinkerScript.cpp:151-159
@@ -147,2 +150,11 @@
 
+void LinkerScript::readEntry() {
+  // -e <symbol> takes predecence over ENTRY(<symbol>).
+  expect("(");
+  StringRef Tok = next();
+  if (Config->Entry.empty())
+    Config->Entry = Tok;
+  expect(")");
+}
+
 void LinkerScript::readOutput() {
----------------
Move this above readGroup.

================
Comment at: test/elf2/linkerscript.s:27
@@ +26,3 @@
+# RUN: llvm-readobj -file-headers -symbols %t2 | \
+# RUN: FileCheck -check-prefix=ENTRY-OVERLOAD %s
+
----------------
Indent with two spaces.


http://reviews.llvm.org/D13509





More information about the llvm-commits mailing list