mirror of
https://github.com/ziglang/zig.git
synced 2024-12-04 02:48:50 +00:00
0edc2b19fe
closes #256
24 lines
429 B
Zig
24 lines
429 B
Zig
const assert = @import("std").debug.assert;
|
|
|
|
comptime {
|
|
if (@compileVar("arch") == Arch.x86_64) {
|
|
asm volatile (
|
|
\\.globl aoeu;
|
|
\\.type aoeu, @function;
|
|
\\.set aoeu, derp;
|
|
);
|
|
}
|
|
}
|
|
|
|
test "module level assembly" {
|
|
if (@compileVar("arch") == Arch.x86_64) {
|
|
assert(aoeu() == 1234);
|
|
}
|
|
}
|
|
|
|
extern fn aoeu() -> i32;
|
|
|
|
export fn derp() -> i32 {
|
|
return 1234;
|
|
}
|