================
@@ -738,6 +738,37 @@ objcopy::parseObjcopyOptions(ArrayRef<const char *> 
RawArgsArr,
   if (auto Arg = InputArgs.getLastArg(OBJCOPY_extract_partition))
     Config.ExtractPartition = Arg->getValue();
 
+  if (const auto *A = InputArgs.getLastArg(OBJCOPY_gap_fill)) {
+    if (Config.OutputFormat != FileFormat::Binary)
+      return createStringError(
+          errc::invalid_argument,
+          "'--gap-fill' is only supported for binary output");
+    ErrorOr<uint64_t> Val = getAsInteger<uint64_t>(A->getValue());
+    if (!Val)
+      return createStringError(Val.getError(), "--gap-fill: bad number: %s",
+                               A->getValue());
+    uint8_t ByteVal = Val.get();
+    if (ByteVal != Val.get())
+      llvm::errs() << "warning: truncating gap-fill from 0x"
+                   << llvm::utohexstr(Val.get(), true) << " to 0x"
+                   << llvm::utohexstr(ByteVal, true) << '\n';
+    Config.GapFill = ByteVal;
+  } else
+    Config.GapFill = 0; // The value of zero is equivalent to no fill.
----------------
jh7370 wrote:

The value of `GapFill` is initialized to 0 already. Do you really need this? 
Same below for `PadTo`.

https://github.com/llvm/llvm-project/pull/65815
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to