mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
use freestanding as wasm32 builtins target
This commit is contained in:
parent
1496ee2e70
commit
8015edccf8
2 changed files with 11 additions and 5 deletions
|
@ -54,7 +54,7 @@ pub fn build(b: *Builder) void {
|
|||
|
||||
// 32-bit wasm
|
||||
wasm32_target.cpu_arch = std.Target.Cpu.Arch.wasm32;
|
||||
wasm32_target.os_tag = std.Target.Os.Tag.wasi;
|
||||
wasm32_target.os_tag = std.Target.Os.Tag.freestanding;
|
||||
wasm32_target.abi = std.Target.Abi.none;
|
||||
|
||||
const obj_name_wasm32 = "builtins-wasm32";
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const testing = std.testing;
|
||||
|
||||
// Dec Module
|
||||
const dec = @import("dec.zig");
|
||||
|
@ -140,13 +138,21 @@ fn exportUtilsFn(comptime func: anytype, comptime func_name: []const u8) void {
|
|||
|
||||
// Custom panic function, as builtin Zig version errors during LLVM verification
|
||||
pub fn panic(message: []const u8, stacktrace: ?*std.builtin.StackTrace) noreturn {
|
||||
if (std.builtin.is_test) {
|
||||
std.debug.print("{s}: {?}", .{ message, stacktrace });
|
||||
} else {
|
||||
_ = message;
|
||||
_ = stacktrace;
|
||||
}
|
||||
|
||||
unreachable;
|
||||
}
|
||||
|
||||
// Run all tests in imported modules
|
||||
// https://github.com/ziglang/zig/blob/master/lib/std/std.zig#L94
|
||||
test "" {
|
||||
const testing = std.testing;
|
||||
|
||||
testing.refAllDecls(@This());
|
||||
}
|
||||
|
||||
|
@ -158,7 +164,7 @@ test "" {
|
|||
//
|
||||
// Thank you Zig Contributors!
|
||||
export fn __muloti4(a: i128, b: i128, overflow: *c_int) callconv(.C) i128 {
|
||||
// @setRuntimeSafety(builtin.is_test);
|
||||
// @setRuntimeSafety(std.builtin.is_test);
|
||||
|
||||
const min = @bitCast(i128, @as(u128, 1 << (128 - 1)));
|
||||
const max = ~min;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue