Go to file
2019-02-08 06:42:44 +00:00
build_sysroot Misc changes 2019-02-06 19:07:21 +01:00
example Fix some warnings 2019-02-06 18:49:59 +01:00
patches Remove 0008-Replace-some-variadic-function-calls-with-unimplemen.patch 2019-02-06 19:22:01 +01:00
src Make codegen_call_inner a bit more readable 2019-02-07 20:28:55 +01:00
.gitignore Stop using xargo for building the sysroot 2018-12-15 16:18:03 +01:00
.travis.yml Stop using xargo for building the sysroot 2018-12-15 16:18:03 +01:00
abc.cpp Implement line debuginfo 2019-01-26 11:59:57 +01:00
Cargo.lock Bump cranelift from 0a04fb6 to 4d92022 2019-02-08 05:37:43 +00:00
Cargo.toml Use IndexSet and keep full source info in set_debug_loc 2019-01-26 11:59:57 +01:00
clean_all.sh Stop using xargo for building the sysroot 2018-12-15 16:18:03 +01:00
config.sh Stop using xargo for building the sysroot 2018-12-15 16:18:03 +01:00
copy.clif Fix some bugs 2018-08-08 10:26:25 +02:00
flamegraph.sh Stop using xargo for building the sysroot 2018-12-15 16:18:03 +01:00
LICENSE-APACHE
LICENSE-MIT
prepare.sh Stop using xargo for building the sysroot 2018-12-15 16:18:03 +01:00
Readme.md Update Readme.md 2019-01-26 17:03:35 +01:00
rust-toolchain
test.sh Implement line debuginfo 2019-01-26 11:59:57 +01:00

Work in progress cranelift codegen backend for rust

⚠⚠⚠ This doesn't do much useful yet ⚠⚠⚠

Building

$ git clone https://github.com/bjorn3/rustc_codegen_cranelift.git
$ cd rustc_codegen_cranelift
$ ./prepare.sh # downloads and patches sysroot src and installs hyperfine for benchmarking
$ ./test.sh

Usage

$cg_clif_dir is the directory you cloned this repo into in the following instruction.

Rustc

$ rustc -Cpanic=abort -Zcodegen-backend=$cg_clif_dir/target/debug/librustc_codegen_cranelift.so my_crate.rs

Cargo

$ RUSTFLAGS="-Cpanic=abort -Zcodegen-backend=$cg_clif_dir/target/debug/librustc_codegen_cranelift.dylib --sysroot $cg_clif_dir/build_sysroot/sysroot" cargo run

Not yet supported

Troubleshooting

Can't compile

Try updating your nightly compiler. You can try to use an nightly a day or two older if updating rustc doesn't fix it. If you still can't compile it, please fill an issue.

error[E0463]: can't find crate for std while compiling a no_std crate

If you use RUSTFLAGS to pass -Zcodegen-backend to rustc, cargo will compile build-dependencies with those flags too. Because this project doesn't support libstd yet, that will result in an error. I don't know of any way to fix this. :(