mirror of
https://github.com/ziglang/zig.git
synced 2024-12-03 18:38:45 +00:00
30f2bb8464
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`.
26 lines
815 B
Zig
26 lines
815 B
Zig
const common = @import("./common.zig");
|
|
|
|
pub const panic = common.panic;
|
|
|
|
comptime {
|
|
if (common.want_ppc_abi) {
|
|
@export(__subtf3, .{ .name = "__subkf3", .linkage = common.linkage, .visibility = common.visibility });
|
|
} else if (common.want_sparc_abi) {
|
|
@export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage, .visibility = common.visibility });
|
|
}
|
|
@export(__subtf3, .{ .name = "__subtf3", .linkage = common.linkage, .visibility = common.visibility });
|
|
}
|
|
|
|
pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 {
|
|
return sub(a, b);
|
|
}
|
|
|
|
fn _Qp_sub(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
|
|
c.* = sub(a.*, b.*);
|
|
}
|
|
|
|
inline fn sub(a: f128, b: f128) f128 {
|
|
const neg_b = @bitCast(f128, @bitCast(u128, b) ^ (@as(u128, 1) << 127));
|
|
return a + neg_b;
|
|
}
|