A Rust procedural macro for GCC style inline assembly. A work in progress, not fully compatible yet. Currently requires nightly.
#![feature(proc_macro)]
#![feature(asm)]
extern crate gcc_asm;
use gcc_asm::gcc_asm;
fn add() {
let a = 1;
let b = 2;
let c;
unsafe {gcc_asm!("add %0, %1, %2" : "=r"(c) : "r"(a), "r"(b))};
assert_eq!(3, c);
}
-
r
constraint -
i
constraint - symbolic labels
-
%=
-
m
constraint -
volatile
- clobbers
-
+
constraint modifier