[PATCH] D22749: [ELF] - Linkerscript: Implemented SORT command

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 15:37:15 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:120-123
@@ +119,6 @@
+template <class ELFT>
+static void addSections(OutputSectionFactory<ELFT> &Factory,
+                        std::vector<OutputSectionBase<ELFT> *> &Out,
+                        std::vector<InputSectionBase<ELFT> *> &In,
+                        StringRef Name, bool Sort) {
+  if (Sort)
----------------
ruiu wrote:
> This little helper seems to take too much arguments. I'd be nice if you can reduce it (though I have no clear idea how.)
I suggest to do sort in separate method then. It helps here + if we will want one day
to support sorting by file name or SORT_BY_ALIGNMENT, we should be able just to extend it/modify.

================
Comment at: ELF/LinkerScript.cpp:728-730
@@ -697,1 +727,5 @@
+    expect(")");
+  }
+  else
+    readInputSectionRules(InCmd, false);
 }
----------------
ruiu wrote:
> Format.
Fixed.

================
Comment at: ELF/LinkerScript.cpp:767
@@ -732,4 +766,3 @@
   while (!Error && !skip("}")) {
-    StringRef Tok = next();
-    if (Tok == "*") {
+    if ((!peek().empty() && peek()[0] == '*') || peek() == "KEEP") {
       auto *InCmd = new InputSectionDescription();
----------------
ruiu wrote:
> peek().startswith("*")
Done (in separate NFC commit).


https://reviews.llvm.org/D22749





More information about the llvm-commits mailing list