Compile libcore to llvm IR (bytecode)

guys,

We are building a symbolic executor for Rust, but got trouble building standard library into llvm IR(bytecode), e.g., libcore.

we tried everything found by google:

  • rustc --emit=llvm-bc src/libcore/lib.rs
  • xbuild etc

nothing worked so far, any idea ? thanks!

What are the problems?

As a workaround you could take libcore-.rlib from somewere in the sysroot (rustc --print sysroot) and use ar x to extract it. One of the files has bc as an extension. I believe it is compressed with flate2, so you will have to decompress it. This is an implementation detail, so it can change at any moment.

What exactly are you getting as an error? rustc --emit=llvm-ir kind of works for me (e.g. it is what cargo llvm-ir uses) and dumps llvm-ir, you could then compile that to bytecode manually.