]> git.lizzy.rs Git - rust.git/blob - Readme.md
8e3105d49cfe91a368c6050ae93b922ca1207c59
[rust.git] / Readme.md
1 # Work in progress cranelift codegen backend for rust
2
3 > ⚠⚠⚠ This doesn't do anything useful yet ⚠⚠⚠
4
5 ## Building
6
7 ```bash
8 $ git clone https://github.com/bjorn3/rustc_codegen_cranelift.git
9 $ cd rustc_codegen_cranelift
10 $ rustup override set nightly
11 $ git submodule update --init
12 $ cargo build
13 ```
14
15 ## Usage
16
17 ```bash
18 $ rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cranelift.so my_crate.rs --crate-type lib -Og
19 ```
20
21 ## Building libcore
22
23 ```bash
24 $ rustup component add rust-src
25 $ ./prepare_libcore.sh
26 $ ./build.sh
27 ```
28
29 > ⚠⚠⚠ You will get a panic because of unimplemented stuff ⚠⚠⚠
30
31 ## Not yet supported
32
33 * Checked binops
34 * Statics
35 * Drop glue
36
37 * Building libraries
38 * Other call abi's
39 * Unsized types
40 * Slice indexing
41 * Sub slice
42 * Some rvalue's
43
44 * Inline assembly
45 * Custom sections
46
47 ## Known errors
48
49 * cranelift-module api seems to be used wrong, thus causing panic for some consts
50 * cranelift-codegen doesn't have encodings for some instructions for types smaller than I32
51
52 ```
53 [...]
54 warning: DefId(0/0:128 ~ lib[8787]::f64[0]::{{impl}}[0]::classify[0]):
55 fn f64::<impl at ./target/libcore/src/libcore/num/f64.rs:156:1: 490:2>::classify(_1: f64) -> num::FpCategory{
56 [...]
57 }
58 warning: stmt _3 = _1
59 warning: stmt _5 = BitAnd(move _6, const Unevaluated(DefId(0/0:130 ~ lib[8787]::f64[0]::{{impl}}[0]::classify[0]::MAN_MASK[0]), []):u64)
60 thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21
61 stack backtrace:
62 [...]
63   10: <core::option::Option<T>>::unwrap
64              at /checkout/src/libcore/macros.rs:20
65   11: rustc_codegen_cranelift::constant::trans_constant
66              at src/constant.rs:26
67 [...]
68 ```