Skip to content

Commit 847cc7a

Browse files
committed
Disable the inline asm support using a feature flag
1 parent 8c7c091 commit 847cc7a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ libloading = { version = "0.6.0", optional = true }
3636
#gimli = { path = "../" }
3737

3838
[features]
39-
default = ["jit"]
39+
default = ["jit", "inline_asm"]
4040
jit = ["cranelift-simplejit", "libloading"]
41+
inline_asm = []
4142

4243
[profile.dev]
4344
# By compiling dependencies with optimizations, performing tests gets much faster.

src/driver/aot.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,20 @@ fn codegen_global_asm(tcx: TyCtxt<'_>, cgu_name: &str, global_asm: &str) {
298298
return;
299299
}
300300

301-
if tcx.sess.target.target.options.is_like_osx || tcx.sess.target.target.options.is_like_windows {
301+
if cfg!(not(feature = "inline_asm"))
302+
|| tcx.sess.target.target.options.is_like_osx
303+
|| tcx.sess.target.target.options.is_like_windows
304+
{
302305
if global_asm.contains("__rust_probestack") {
303306
return;
304307
}
305308

306309
// FIXME fix linker error on macOS
307-
tcx.sess.fatal("asm! and global_asm! are not yet supported on macOS and Windows");
310+
if cfg!(not(feature = "inline_asm")) {
311+
tcx.sess.fatal("asm! and global_asm! support is disabled while compiling rustc_codegen_cranelift");
312+
} else {
313+
tcx.sess.fatal("asm! and global_asm! are not yet supported on macOS and Windows");
314+
}
308315
}
309316

310317
let assembler = crate::toolchain::get_toolchain_binary(tcx.sess, "as");

0 commit comments

Comments
 (0)