[PATCH] D22660: [ELF/LinkerScript] Support ONLY_IF_{RO, RW} directive

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 19:37:34 PDT 2016


ruiu added a comment.

Is this a feature to build FreeBSD?


================
Comment at: ELF/LinkerScript.cpp:269
@@ -269,1 +268,3 @@
+  auto AddInputSec = [&](InputSectionBase<ELFT> *C, StringRef Name,
+                         ConstraintKind Constraint = NoConstraint) {
     OutputSectionBase<ELFT> *Sec;
----------------
I would not use a default argument here.

================
Comment at: ELF/LinkerScript.cpp:282
@@ +281,3 @@
+         Constraint == ReadOnly) {
+      Sec->DiscardFromOutput = true;
+      return;
----------------
Why don't you set Live flag of the section to false?

================
Comment at: ELF/LinkerScript.cpp:816
@@ +815,3 @@
+  StringRef Tok = peek();
+  if (Tok == "ONLY_IF_RO") {
+    next();
----------------
You can write

  if (skip("ONLY_IF_RO"))

================
Comment at: ELF/LinkerScript.h:70
@@ -63,2 +69,3 @@
   std::vector<uint8_t> Filler;
+  ConstraintKind Constraint;
 };
----------------
  ConstraintKind Constraint = NoConstraint;


https://reviews.llvm.org/D22660





More information about the llvm-commits mailing list