Disable the inline asm support using a feature flag

This commit is contained in:
bjorn3 2020-08-15 14:19:23 +02:00
parent 8c7c091244
commit 847cc7ab2a
2 changed files with 11 additions and 3 deletions

View file

@ -36,8 +36,9 @@ libloading = { version = "0.6.0", optional = true }
#gimli = { path = "../" }
[features]
default = ["jit"]
default = ["jit", "inline_asm"]
jit = ["cranelift-simplejit", "libloading"]
inline_asm = []
[profile.dev]
# By compiling dependencies with optimizations, performing tests gets much faster.

View file

@ -298,13 +298,20 @@ fn codegen_global_asm(tcx: TyCtxt<'_>, cgu_name: &str, global_asm: &str) {
return;
}
if tcx.sess.target.target.options.is_like_osx || tcx.sess.target.target.options.is_like_windows {
if cfg!(not(feature = "inline_asm"))
|| tcx.sess.target.target.options.is_like_osx
|| tcx.sess.target.target.options.is_like_windows
{
if global_asm.contains("__rust_probestack") {
return;
}
// FIXME fix linker error on macOS
tcx.sess.fatal("asm! and global_asm! are not yet supported on macOS and Windows");
if cfg!(not(feature = "inline_asm")) {
tcx.sess.fatal("asm! and global_asm! support is disabled while compiling rustc_codegen_cranelift");
} else {
tcx.sess.fatal("asm! and global_asm! are not yet supported on macOS and Windows");
}
}
let assembler = crate::toolchain::get_toolchain_binary(tcx.sess, "as");