I'm currently trying to convert LLVM-IR code into a final executable/binary file. Specifically, I want to generate the LLVM-IR of a program using cargo rustc -- --emit=llvm-ir
, then perform some analysis on that LLVM-IR, and finally compile that LLVM-IR code into a binary. Here are the steps I've taken so far:
- Emit llvm-ir:
cargo rustc -- --emit=llvm-ir
- Process the analysis and generate
program.ll
- Generate object code:
llc program.ll --filetype=obj
However, I'm unsure about the subsequent steps. To my knowledge, there should be a way to create a binary from the LLVM-IR code using cargo
and rustc
. Could anyone guide me on how to achieve this?
Thank you!
Have a nice Day