【发布时间】:2015-12-27 04:09:02
【问题描述】:
我在test.s中有以下代码:
call $8 + $8
运行nasm test.s 编译成功。我希望以下等效的 Rust 代码能够成功编译,但事实并非如此。
在test.rs:
#![feature(asm)]
fn main() {
unsafe {
asm! (
"call $0 + $0"
:
: "i" (8)
: "memory"
: "volatile"
)
}
}
rustc test.rs的输出:
test.rs:4:9: 10:11 error: <inline asm>:1:12: error: invalid token in expression
call $8 + $8
^
【问题讨论】:
-
你到底想做什么?还是您只是在尝试?
标签: rust inline-assembly