Compiling libstd to LLVM bitcode


I am looking for a way to compile libstd to bitcode. The reason why I need a bitcode version of libstd is that I am trying to execute Rust on an LLVM bitcode interpreter. Linking with works, but I want to reduce the traffic accross the interpreter’s native interface to a minimum. Interpreting libstd instead of executing native calls to it appears to be a promising approach.

libstd has been Cargoified - so I tried:
cd src/libstd && cargo rustc -- --emit=llvm-bc
Unfortunately, I couldn’t find a toolchain configuration where this results in a successful build.

The following gets me a std.bc:
cd src/libstd && rustc --emit=llvm-bc
However, in this case I don’t know what to do with libcore. If I compile libcore separately with
cd src/libcore && rustc --emit=llvm-bc the function signatures in libstd and libcore won’t match.