bundle compiler-rt through zig

This commit is contained in:
Brendan Hansknecht 2023-12-08 13:36:04 -08:00
parent f738d5a2bf
commit be06599bb6
No known key found for this signature in database
GPG key ID: A199D0660F95F948
4 changed files with 8 additions and 8 deletions

View file

@ -59,6 +59,7 @@ fn generateLlvmIrFile(
const obj = b.addObject(.{ .name = object_name, .root_source_file = main_path, .optimize = mode, .target = target, .use_llvm = true });
obj.strip = true;
obj.disable_stack_probing = true;
obj.bundle_compiler_rt = true;
// Generating the bin seems required to get zig to generate the llvm ir.
_ = obj.getEmittedBin();
@ -91,6 +92,7 @@ fn generateObjectFile(
obj.link_function_sections = true;
obj.force_pic = true;
obj.disable_stack_probing = true;
obj.bundle_compiler_rt = true;
const obj_file = obj.getEmittedBin();

View file

@ -6,10 +6,10 @@ const expect = @import("expect.zig");
const panic_utils = @import("panic.zig");
const dbg_utils = @import("dbg.zig");
comptime {
_ = @import("compiler_rt.zig");
_ = @import("libc.zig");
}
// comptime {
// _ = @import("compiler_rt.zig");
// _ = @import("libc.zig");
// }
const ROC_BUILTINS = "roc_builtins";
const NUM = "num";

View file

@ -215,9 +215,7 @@ pub fn exportRound(comptime F: type, comptime T: type, comptime name: []const u8
pub fn exportFloor(comptime F: type, comptime T: type, comptime name: []const u8) void {
comptime var f = struct {
fn func(input: F) callconv(.C) T {
// intFromFloat just returns the integer part of the float.
// This means it automatically floors. No need for an explicit call to floor.
return @as(T, @intFromFloat(input));
return @as(T, @intFromFloat((math.floor(input))));
}
}.func;
@export(f, .{ .name = name ++ @typeName(T), .linkage = .Strong });

View file

@ -235,7 +235,7 @@ len : Dict * * -> Nat
len = \@Dict { data } ->
List.len data
## Check if the dictinoary is empty.
## Check if the dictionary is empty.
## ```
## Dict.isEmpty (Dict.empty {} |> Dict.insert "key" 42)
##