[llvm] Add llvm-extract-bundle-entry to extend llvm-objcopy (PR #169386)

David Salinas via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 18 08:31:12 PST 2025


================
@@ -1670,3 +1716,41 @@ objcopy::parseStripOptions(ArrayRef<const char *> RawArgsArr,
 
   return std::move(DC);
 }
+
+Expected<DriverConfig> objcopy::parseExtractBundleEntryOptions(
+    ArrayRef<const char *> ArgsArr, function_ref<Error(Error)> ErrorCallback) {
+
+  DriverConfig DC;
+
+  ExtractBundleEntryOptTable T;
+  unsigned MissingArgumentIndex, MissingArgumentCount;
+  opt::InputArgList InputArgs =
+      T.ParseArgs(ArgsArr, MissingArgumentIndex, MissingArgumentCount);
+
+  if (InputArgs.size() == 0) {
+    printHelp(T, errs(), ToolType::ExtractBundleEntry);
+    exit(1);
+  }
+
+  if (InputArgs.hasArg(EXTRACT_BUNDLE_ENTRY_help)) {
+    printHelp(T, outs(), ToolType::ExtractBundleEntry);
+    exit(0);
+  }
+
+  for (auto *Arg : InputArgs.filtered(EXTRACT_BUNDLE_ENTRY_UNKNOWN))
+    return createStringError(errc::invalid_argument, "unknown argument '%s'",
+                             Arg->getAsString(InputArgs).c_str());
+
+  SmallVector<StringRef, 256> Positional;
+
+  for (auto *Arg : InputArgs.filtered(EXTRACT_BUNDLE_ENTRY_INPUT))
+    Positional.push_back(Arg->getValue());
+  assert(!Positional.empty());
+
+  // iterate over all input arguments
+  for (auto input : Positional)
----------------
david-salinas wrote:

ok

https://github.com/llvm/llvm-project/pull/169386


More information about the llvm-commits mailing list