mozilla/rust — pull request #5317 by luqmana (2013-03-11 18:16:05+00:00)
Title: Inline assembly

```Rust
#[cfg(target_os = "macos")]
fn helloworld() {
unsafe {
asm!(".pushsection __RODATA, __rodata
msg: .asciz \"Hello World!\"
.popsection
movq msg@GOTPCREL(%rip), %rdi
call _puts");
}
}

#[cfg(target_os = "linux")]
fn helloworld() {
unsafe {
asm!(".pushsection .rodata
msg: .asciz \"Hello World!\"
.popsection
movq msg@GOTPCREL(%rip), %rdi
call puts");
}
}

fn main() {
helloworld();
}
```

```
% rustc foo.rs
% ./foo
Hello World!
```