From 847cc7ab2a96c9d2f3c225dc8e86f19a24eefcb4 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 15 Aug 2020 14:19:23 +0200 Subject: [PATCH] Disable the inline asm support using a feature flag --- Cargo.toml | 3 ++- src/driver/aot.rs | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) 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");