Whole Program LLVM for Rust?

Whole Program LLVM is a compiler wrapper for C and C++ that lets you build whole program as LLVM bitcode without source or build system modification.

Is there something similar for Rust?

On the playground there is an option to see llvm IR, and as such, there is an option to emit it:

cargo rustc -- --emit=llvm-ir

The resulting .ll files can be found in <Cargo.toml DIR>/target/[debug|release]/deps/

1 Like

That's not what I am looking for. rustc --emit llvm-bc is equivalent to clang -emit-llvm. Both builds LLVM bitcode for a single translation unit (crate in the case of Rust), not for the whole program.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.