[PATCH] D108985: [objcopy] Enable llvm options to be passed via $LLVM_OPTS

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 04:19:01 PDT 2021


sbc100 created this revision.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
Herald added subscribers: wingo, abrachet.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay, aheejin.
Herald added a project: LLVM.

I was recently debugging an issue with llvm-objcopy and noticed that
there was no way to set `-debug` or `-debug-only=xxx` options.

Even though llvm-objcopy does it own custom arugment parsing I think it
is still useful to be able set common/shared llvm options like this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108985

Files:
  llvm/tools/llvm-objcopy/llvm-objcopy.cpp


Index: llvm/tools/llvm-objcopy/llvm-objcopy.cpp
===================================================================
--- llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -417,6 +417,9 @@
                               ? cl::TokenizeWindowsCommandLine
                               : cl::TokenizeGNUCommandLine,
                           NewArgv);
+  // Allow llvm options to be passed via $LLVM_OPTS.  This is useful for
+  // enabling common flags such as -debug.
+  cl::ParseCommandLineOptions(1, argv, "llvm-objcopy", nullptr, "LLVM_OPTS");
 
   auto Args = makeArrayRef(NewArgv).drop_front();
   Expected<DriverConfig> DriverConfig = getDriverConfig(Args);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108985.369675.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210831/6cb7b2ad/attachment.bin>


More information about the llvm-commits mailing list