diff --git a/Cargo.toml b/Cargo.toml index f16d45cd46a..511c348abf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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. diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 9f6b0c51475..17688caada4 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -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");