Stabilize asm_sym
This commit is contained in:
parent
413edf6771
commit
14e0e0fec3
@ -3,11 +3,12 @@
|
|||||||
// Run-time:
|
// Run-time:
|
||||||
// status: 0
|
// status: 0
|
||||||
|
|
||||||
#![feature(asm_const, asm_sym)]
|
#![feature(asm_const)]
|
||||||
|
|
||||||
use std::arch::{asm, global_asm};
|
use std::arch::{asm, global_asm};
|
||||||
|
|
||||||
global_asm!("
|
global_asm!(
|
||||||
|
"
|
||||||
.global add_asm
|
.global add_asm
|
||||||
add_asm:
|
add_asm:
|
||||||
mov rax, rdi
|
mov rax, rdi
|
||||||
@ -132,7 +133,9 @@ fn main() {
|
|||||||
assert_eq!(x, 43);
|
assert_eq!(x, 43);
|
||||||
|
|
||||||
// check sym fn
|
// check sym fn
|
||||||
extern "C" fn foo() -> u64 { 42 }
|
extern "C" fn foo() -> u64 {
|
||||||
|
42
|
||||||
|
}
|
||||||
let x: u64;
|
let x: u64;
|
||||||
unsafe {
|
unsafe {
|
||||||
asm!("call {}", sym foo, lateout("rax") x);
|
asm!("call {}", sym foo, lateout("rax") x);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user