2017-05-02 01:12:38 +08:00
|
|
|
const config = @import("builtin");
|
2017-04-05 07:47:22 +08:00
|
|
|
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) {
|
2017-04-05 07:47:22 +08:00
|
|
|
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) {
|
2017-04-05 07:47:22 +08:00
|
|
|
assert(aoeu() == 1234);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-25 17:10:11 +08:00
|
|
|
extern fn aoeu() i32;
|
2017-04-05 07:47:22 +08:00
|
|
|
|
2018-01-25 17:10:11 +08:00
|
|
|
export fn derp() i32 {
|
2017-04-05 07:47:22 +08:00
|
|
|
return 1234;
|
|
|
|
}
|