zig/test/cases/asm.zig

25 lines
528 B
Zig
Raw Normal View History

const config = @import("builtin");
const assert = @import("std").debug.assert;
comptime {
2017-08-27 12:11:09 +08:00
if (config.arch == config.Arch.x86_64 and config.os == config.Os.linux) {
asm volatile (
\\.globl aoeu;
\\.type aoeu, @function;
\\.set aoeu, derp;
);
}
}
test "module level assembly" {
2017-08-27 12:11:09 +08:00
if (config.arch == config.Arch.x86_64 and config.os == config.Os.linux) {
assert(aoeu() == 1234);
}
}
extern fn aoeu() -> i32;
export fn derp() -> i32 {
return 1234;
}