How to pass arguments to the pass in LLVM 15?

Hi all. I was using the Hello Pass, which is modified from the LLVM project Hello.cpp.

In this pass, I defined a bool variable HELLO,

static cl::opt<bool> HELLO("hello", 

which is intended to receive an argument from the command line.

The way I use this pass in LTO is below:

ld.lld --lto-newpm-passes=helloworld -hello

But the error messages indicate argument hello is invalid.
This pass is registered to the New Pass Manager. So how can we provide arguments to such LLVM passes?
Any comment is welcomed. Thanks in advance!

Would -mllvm -hello work?

1 Like

It works. Thank you nikic!
The correct option should be:

ld.lld --lto-newpm-passes=helloworld -mllvm -hello=true