llvm-plugin-rs icon indicating copy to clipboard operation
llvm-plugin-rs copied to clipboard

Function passes are completely broken.

Open ethanuppal opened this issue 1 year ago • 4 comments

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:

  1. Open a macOS 15 docker image.
  2. Setup Rust/brew.
  3. brew install llvm@18 (I tried @17 and @14 too)
  4. Copy-paste the hello world example code
  5. panic!() in the run_pass implementation function
  6. 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

ethanuppal avatar Mar 10 '25 10:03 ethanuppal

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?

jamesmth avatar Mar 14 '25 14:03 jamesmth

Just macOS --- I can try on my Linux dual boot if you want though

ethanuppal avatar Mar 14 '25 20:03 ethanuppal

If you don't mind testing on Linux, I'd be interested to know how it goes!

jamesmth avatar Mar 16 '25 14:03 jamesmth

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?

jamesmth avatar Jun 29 '25 13:06 jamesmth