[PATCH] D17242: [ELF] - Linkerscript KEEP command.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 10:25:16 PST 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:55
@@ +54,3 @@
+  SectionRule *R = find(S);
+  return R ? R->Keep : false;
+}
----------------
return R && R->Keep;

================
Comment at: ELF/LinkerScript.cpp:395
@@ +394,3 @@
+  expect("(");
+  while (!skip(")")) {
+    SectionRule R = {OutSec, next()};
----------------
Did you test this code with an incomplete input? I think this will fall into an infinite loop if you give

  SECTIONS { .foo : { KEEP(

================
Comment at: ELF/LinkerScript.cpp:396
@@ +395,3 @@
+  while (!skip(")")) {
+    SectionRule R = {OutSec, next()};
+    R.Keep = Keep;
----------------
Why don't you add Keep as a parameter to the constructor?

================
Comment at: ELF/LinkerScript.h:58
@@ +57,3 @@
+  template <class ELFT>
+  SectionRule *LinkerScript::find(InputSectionBase<ELFT> *S);
+
----------------
Remove `LinkerScript::`.


http://reviews.llvm.org/D17242





More information about the llvm-commits mailing list