zig/test/cases/asm.zig
Andrew Kelley 9d9201c3b4 bring back code that uses export and fix tests
partial revert of 1fdebc1dc4881a00766f7c2b4b2d8ee6ad6e79b6
2017-12-19 02:39:43 -05:00

25 lines
528 B
Zig

const config = @import("builtin");
const assert = @import("std").debug.assert;
comptime {
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" {
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;
}