mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
31 lines
445 B
Rust
31 lines
445 B
Rust
// run-pass
|
|
// needs-asm-support
|
|
|
|
#![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() {}
|