[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
Wed Sep 1 02:22:53 PDT 2021


sbc100 added a comment.

In D108985#2976316 <https://reviews.llvm.org/D108985#2976316>, @MaskRay wrote:

> `-debug` or `-debug-only=xxx` is for IR optimization and code generation debugging.

I don't see anything IR specific about the `-debug` or `-debug-only` options.  Anyone who uses the `include/llvm/Support/Debug.h` facilities relies on being able to set these options.   I use them a lot when debugging `wasm-ld` for example, and in this case I was specifically interesting in the debugging libObject  (where I use these macros: https://github.com/llvm/llvm-project/blob/fb321c2ea274c1bd1e1b294f2c090f1c0d9a97fe/llvm/lib/Object/WasmObjectFile.cpp#L35) usage in llvm-objcopy

> I am not sure such options are generally useful to llvm-objcopy.
> Non-assert builds even make such options no-op, so I am concerned that `LLVM_OPTS` will be used to do such debugging.

True these option only make sense in debug builds.. but  that is true for all our tools such as clang and lld too. They both provide ways of accepting these options.  As do any of the tools under `llvm/tools` that already call `ParseCommandLineOptions`.   I think it would be useful to add the ability to accept these args in all tools, otherwise there is no way to enable the debugging code which is built into them.

> I agree that this needs a wide discussion.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108985/new/

https://reviews.llvm.org/D108985



More information about the llvm-commits mailing list