mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
When we're compiling compiler_rt for any WebAssembly target, we do not want to expose all the compiler-rt functions to the host runtime. By setting the visibility of all exports to `hidden`, we allow the linker to resolve the symbols during linktime, while not expose the functions to the host runtime. This also means the linker can properly garbage collect any compiler-rt function that does not get resolved. The symbol visibility for all target remains the same as before: `default`.
22 lines
748 B
Zig
22 lines
748 B
Zig
const common = @import("./common.zig");
|
|
const intToFloat = @import("./int_to_float.zig").intToFloat;
|
|
|
|
pub const panic = common.panic;
|
|
|
|
comptime {
|
|
if (common.want_ppc_abi) {
|
|
@export(__floatunsitf, .{ .name = "__floatunsikf", .linkage = common.linkage, .visibility = common.visibility });
|
|
} else if (common.want_sparc_abi) {
|
|
@export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = common.linkage, .visibility = common.visibility });
|
|
}
|
|
@export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage, .visibility = common.visibility });
|
|
}
|
|
|
|
pub fn __floatunsitf(a: u32) callconv(.C) f128 {
|
|
return intToFloat(f128, a);
|
|
}
|
|
|
|
fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void {
|
|
c.* = intToFloat(f128, a);
|
|
}
|