2017-05-01 10:12:38 -07:00
|
|
|
const config = @import("builtin");
|
2017-04-04 16:47:22 -07:00
|
|
|
const assert = @import("std").debug.assert;
|
|
|
|
|
|
|
|
comptime {
|
2017-05-01 10:12:38 -07:00
|
|
|
if (config.arch == config.Arch.x86_64) {
|
2017-04-04 16:47:22 -07:00
|
|
|
asm volatile (
|
|
|
|
\\.globl aoeu;
|
|
|
|
\\.type aoeu, @function;
|
|
|
|
\\.set aoeu, derp;
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test "module level assembly" {
|
2017-05-01 10:12:38 -07:00
|
|
|
if (config.arch == config.Arch.x86_64) {
|
2017-04-04 16:47:22 -07:00
|
|
|
assert(aoeu() == 1234);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extern fn aoeu() -> i32;
|
|
|
|
|
|
|
|
export fn derp() -> i32 {
|
|
|
|
return 1234;
|
|
|
|
}
|