rust/src/test/ui/simple_global_asm.rs

25 lines
410 B
Rust
Raw Normal View History

// run-pass
2017-03-22 04:47:25 +00:00
#![feature(global_asm)]
#![feature(naked_functions)]
#![allow(dead_code)]
2017-03-22 04:47:25 +00:00
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
global_asm!(r#"
.global foo
.global _foo
2017-03-22 04:47:25 +00:00
foo:
_foo:
ret
2017-03-22 04:47:25 +00:00
"#);
extern {
fn foo();
}
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
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() {}