File tree Expand file tree Collapse file tree 7 files changed +23
-11
lines changed Expand file tree Collapse file tree 7 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ smallvec = "1.6.1"
37
37
# gimli = { path = "../" }
38
38
39
39
[features ]
40
- default = [" jit" , " inline_asm" ]
40
+ # Enable features not ready to be enabled when compiling as part of rustc
41
+ unstable-features = [" jit" , " inline_asm" ]
41
42
jit = [" cranelift-jit" , " libloading" ]
42
43
inline_asm = []
43
44
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use std::process::Command;
4
4
5
5
pub ( crate ) fn build_backend ( channel : & str , host_triple : & str ) -> PathBuf {
6
6
let mut cmd = Command :: new ( "cargo" ) ;
7
- cmd. arg ( "build" ) . arg ( "--target" ) . arg ( host_triple) ;
7
+ cmd. arg ( "build" ) . arg ( "--target" ) . arg ( host_triple) . arg ( "--features" ) . arg ( "unstable-features" ) ;
8
8
9
9
match channel {
10
10
"debug" => { }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ $ $cg_clif_dir/build/cargo jit
36
36
or
37
37
38
38
``` bash
39
- $ $cg_clif_dir /build/bin/cg_clif -Cllvm-args=mode=jit -Cprefer-dynamic my_crate.rs
39
+ $ $cg_clif_dir /build/bin/cg_clif -Zunstable-features - Cllvm-args=mode=jit -Cprefer-dynamic my_crate.rs
40
40
```
41
41
42
42
There is also an experimental lazy jit mode. In this mode functions are only compiled once they are
@@ -52,7 +52,7 @@ These are a few functions that allow you to easily run rust code from the shell
52
52
53
53
``` bash
54
54
function jit_naked() {
55
- echo " $@ " | $cg_clif_dir /build/bin/cg_clif - -Cllvm-args=mode=jit -Cprefer-dynamic
55
+ echo " $@ " | $cg_clif_dir /build/bin/cg_clif - -Zunstable-features - Cllvm-args=mode=jit -Cprefer-dynamic
56
56
}
57
57
58
58
function jit() {
Original file line number Diff line number Diff line change @@ -44,7 +44,11 @@ fn main() {
44
44
) ;
45
45
std:: array:: IntoIter :: new ( [ "rustc" . to_string ( ) ] )
46
46
. chain ( env:: args ( ) . skip ( 2 ) )
47
- . chain ( [ "--" . to_string ( ) , "-Cllvm-args=mode=jit" . to_string ( ) ] )
47
+ . chain ( [
48
+ "--" . to_string ( ) ,
49
+ "-Zunstable-features" . to_string ( ) ,
50
+ "-Cllvm-args=mode=jit" . to_string ( ) ,
51
+ ] )
48
52
. collect ( )
49
53
}
50
54
Some ( "lazy-jit" ) => {
@@ -54,7 +58,11 @@ fn main() {
54
58
) ;
55
59
std:: array:: IntoIter :: new ( [ "rustc" . to_string ( ) ] )
56
60
. chain ( env:: args ( ) . skip ( 2 ) )
57
- . chain ( [ "--" . to_string ( ) , "-Cllvm-args=mode=jit-lazy" . to_string ( ) ] )
61
+ . chain ( [
62
+ "--" . to_string ( ) ,
63
+ "-Zunstable-features" . to_string ( ) ,
64
+ "-Cllvm-args=mode=jit-lazy" . to_string ( ) ,
65
+ ] )
58
66
. collect ( )
59
67
}
60
68
_ => env:: args ( ) . skip ( 1 ) . collect ( ) ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ pushd $(dirname "$0")/../
5
5
source scripts/config.sh
6
6
RUSTC=" $( pwd) /build/bin/cg_clif"
7
7
popd
8
- PROFILE=$1 OUTPUT=$2 exec $RUSTC -Cllvm-args=mode=jit -Cprefer-dynamic $0
8
+ PROFILE=$1 OUTPUT=$2 exec $RUSTC -Zunstable-options - Cllvm-args=mode=jit -Cprefer-dynamic $0
9
9
# */
10
10
11
11
//! This program filters away uninteresting samples and trims uninteresting frames for stackcollapse
Original file line number Diff line number Diff line change @@ -16,10 +16,10 @@ function no_sysroot_tests() {
16
16
17
17
if [[ " $JIT_SUPPORTED " = " 1" ]]; then
18
18
echo " [JIT] mini_core_hello_world"
19
- CG_CLIF_JIT_ARGS=" abc bcd" $MY_RUSTC -Cllvm-args=mode=jit -Cprefer-dynamic example/mini_core_hello_world.rs --cfg jit --target " $HOST_TRIPLE "
19
+ CG_CLIF_JIT_ARGS=" abc bcd" $MY_RUSTC -Zunstable-options - Cllvm-args=mode=jit -Cprefer-dynamic example/mini_core_hello_world.rs --cfg jit --target " $HOST_TRIPLE "
20
20
21
21
echo " [JIT-lazy] mini_core_hello_world"
22
- CG_CLIF_JIT_ARGS=" abc bcd" $MY_RUSTC -Cllvm-args=mode=jit-lazy -Cprefer-dynamic example/mini_core_hello_world.rs --cfg jit --target " $HOST_TRIPLE "
22
+ CG_CLIF_JIT_ARGS=" abc bcd" $MY_RUSTC -Zunstable-options - Cllvm-args=mode=jit-lazy -Cprefer-dynamic example/mini_core_hello_world.rs --cfg jit --target " $HOST_TRIPLE "
23
23
else
24
24
echo " [JIT] mini_core_hello_world (skipped)"
25
25
fi
@@ -44,10 +44,10 @@ function base_sysroot_tests() {
44
44
45
45
if [[ " $JIT_SUPPORTED " = " 1" ]]; then
46
46
echo " [JIT] std_example"
47
- $MY_RUSTC -Cllvm-args=mode=jit -Cprefer-dynamic example/std_example.rs --target " $HOST_TRIPLE "
47
+ $MY_RUSTC -Zunstable-options - Cllvm-args=mode=jit -Cprefer-dynamic example/std_example.rs --target " $HOST_TRIPLE "
48
48
49
49
echo " [JIT-lazy] std_example"
50
- $MY_RUSTC -Cllvm-args=mode=jit-lazy -Cprefer-dynamic example/std_example.rs --target " $HOST_TRIPLE "
50
+ $MY_RUSTC -Zunstable-options - Cllvm-args=mode=jit-lazy -Cprefer-dynamic example/std_example.rs --target " $HOST_TRIPLE "
51
51
else
52
52
echo " [JIT] std_example (skipped)"
53
53
fi
Original file line number Diff line number Diff line change @@ -184,6 +184,9 @@ impl CodegenBackend for CraneliftCodegenBackend {
184
184
let config = if let Some ( config) = self . config . clone ( ) {
185
185
config
186
186
} else {
187
+ if !tcx. sess . unstable_options ( ) && !tcx. sess . opts . cg . llvm_args . is_empty ( ) {
188
+ tcx. sess . fatal ( "`-Z unstable-options` must be passed to allow configuring cg_clif" ) ;
189
+ }
187
190
BackendConfig :: from_opts ( & tcx. sess . opts . cg . llvm_args )
188
191
. unwrap_or_else ( |err| tcx. sess . fatal ( & err) )
189
192
} ;
You can’t perform that action at this time.
0 commit comments