Function passes are completely broken.
Description
Function passes do not work. Module passes work.
To Reproduce
I have reproduced this on a clean macOS 15 docker image. You can reproduce as follows:
- Open a macOS 15 docker image.
- Setup Rust/brew.
-
brew install llvm@18(I tried@17and@14too) - Copy-paste the hello world example code
-
panic!()in therun_passimplementation function - Notice that there is no panic
You can get a panic by putting it right before you register the pass; clearly it is registered since you will be allowed to --passes=hello-world.
Expected behavior
These steps should lead to panic
Screenshots
N/A
Environment
Whatever environment GitHub uses for their macos-15 runners. I tried LLVM 14, 17, and 18.
Additional context
Thanks for reporting this bug, I'll investigate when I have the time.
Is is macOS-specific, or did you try on Windows/Linux as well?
Just macOS --- I can try on my Linux dual boot if you want though
If you don't mind testing on Linux, I'd be interested to know how it goes!
I didn't manage to reproduce the bug on MacOS Sequoia 15.5 (24F74).
uname -v
Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:26 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8112
Here is what I did:
> git clone https://github.com/jamesmth/llvm-plugin-rs.git && cd llvm-plugin-rs
# ...
> brew install llvm@18
# ...
> export LLVM_SYS_181_PREFIX=/opt/homebrew/opt/llvm@18
> cargo b --examples --features llvm18-1
# ...
> "$LLVM_SYS_181_PREFIX/bin/opt" --load-pass-plugin=target/debug/examples/libhello_world.dylib --passes=hello-world tests/test.ll -disable-output
(llvm-tutor) Hello from: "main"
(llvm-tutor) number of arguments: 0
@ethanuppal Do you still have this bug? If so, could you provide more details for reproducing it?