[PATCH] D24891: [ELF] Support -z max-page-size option

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 24 21:05:10 PDT 2016


davide added a comment.

What happens if you pass a negative value to `-z common-page-size` ?


================
Comment at: ELF/Driver.cpp:660-667
@@ -659,1 +659,10 @@
 
+  auto ConfigZOpt = [&](StringRef Opt, uint64_t &Dest, uint64_t Default) {
+    if (Optional<StringRef> Value = getZOptionValue(Args, Opt)) {
+      if (Value->getAsInteger(0, Dest))
+        error("invalid " + Opt + ": " + *Value);
+    } else {
+      Dest = Default;
+    }
+  };
+
----------------
There are other -z options supported, but not all of them take an integer option, e.g. `-z now`. Can this function be generalized to cover all them? That seems a little bit too much to ask, so you can probably just rename this one.

================
Comment at: ELF/Driver.cpp:662-663
@@ +661,4 @@
+    if (Optional<StringRef> Value = getZOptionValue(Args, Opt)) {
+      if (Value->getAsInteger(0, Dest))
+        error("invalid " + Opt + ": " + *Value);
+    } else {
----------------
can you add a test for this case?


https://reviews.llvm.org/D24891





More information about the llvm-commits mailing list