rust/src/test/ui/simple_global_asm.rs
Amanieu d'Antras 44a3a66ee8 Stabilize asm! and global_asm!
They are also removed from the prelude as per the decision in
https://github.com/rust-lang/rust/issues/87228.

stdarch and compiler-builtins are updated to work with the new, stable
asm! and global_asm! macros.
2021-12-12 11:20:03 +00:00

30 lines
424 B
Rust

// run-pass
#![feature(naked_functions)]
#![allow(dead_code)]
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
core::arch::global_asm!(
r#"
.global foo
.global _foo
foo:
_foo:
ret
"#
);
extern "C" {
fn foo();
}
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
fn main() {
unsafe {
foo();
}
}
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
fn main() {}