rust/tests/ui/simple_global_asm.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
445 B
Rust
Raw Normal View History

// run-pass
// needs-asm-support
#![feature(naked_functions)]
#![allow(dead_code)]
2017-03-22 04:47:25 +00:00
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
core::arch::global_asm!(
2020-09-01 21:12:52 +00:00
r#"
2017-03-22 04:47:25 +00:00
.global foo
.global _foo
2017-03-22 04:47:25 +00:00
foo:
_foo:
ret
2020-09-01 21:12:52 +00:00
"#
);
2017-03-22 04:47:25 +00:00
2020-09-01 21:12:52 +00:00
extern "C" {
2017-03-22 04:47:25 +00:00
fn foo();
}
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
2020-09-01 21:12:52 +00:00
fn main() {
unsafe {
foo();
}
}
2017-03-22 04:47:25 +00:00
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
2017-03-22 04:47:25 +00:00
fn main() {}