diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs index d83fb2aece9..9c2ab5a5165 100644 --- a/example/mini_core_hello_world.rs +++ b/example/mini_core_hello_world.rs @@ -285,18 +285,18 @@ fn main() { #[cfg(not(jit))] test_tls(); - #[cfg(not(jit))] + #[cfg(all(not(jit), target_os = "linux"))] unsafe { global_asm_test(); } } -#[cfg(not(jit))] +#[cfg(all(not(jit), target_os = "linux"))] extern "C" { fn global_asm_test(); } -#[cfg(not(jit))] +#[cfg(all(not(jit), target_os = "linux"))] global_asm! { " .global global_asm_test diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 4128148ed36..48445c43a92 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -277,6 +277,15 @@ 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 global_asm.contains("__rust_probestack") { + return; + } + + // FIXME fix linker error on macOS + tcx.sess.fatal("global_asm! is not yet supported on macOS and Windows"); + } + let assembler = crate::toolchain::get_toolchain_binary(tcx.sess, "as"); let linker = crate::toolchain::get_toolchain_binary(tcx.sess, "ld");