1
Fork 0

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 = "../" } #gimli = { path = "../" }
[features] [features]
default = ["jit"] default = ["jit", "inline_asm"]
jit = ["cranelift-simplejit", "libloading"] jit = ["cranelift-simplejit", "libloading"]
inline_asm = []
[profile.dev] [profile.dev]
# By compiling dependencies with optimizations, performing tests gets much faster. # By compiling dependencies with optimizations, performing tests gets much faster.

View file

@ -298,14 +298,21 @@ fn codegen_global_asm(tcx: TyCtxt<'_>, cgu_name: &str, global_asm: &str) {
return; 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") { if global_asm.contains("__rust_probestack") {
return; return;
} }
// FIXME fix linker error on macOS // FIXME fix linker error on macOS
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"); 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"); let assembler = crate::toolchain::get_toolchain_binary(tcx.sess, "as");
let linker = crate::toolchain::get_toolchain_binary(tcx.sess, "ld"); let linker = crate::toolchain::get_toolchain_binary(tcx.sess, "ld");