authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-07 17:41:20-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-07 17:44:49-07:00
log663b67783e3e140fcaf06747f4aa28b57259023c
tree225da9aec9bbcd99ed33617d0f05a56907e261c0
parentaa05cd48097b42d0c52ff5e0f3dd1ece68d1cdcd

compiler-rt: avoid symbol collisions with Windows libc

closes #11600

1 files changed, 7 insertions(+), 7 deletions(-)

lib/compiler_rt.zig+7-7
...@@ -724,24 +724,24 @@ comptime {...@@ -724,24 +724,24 @@ comptime {
724 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage });724 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage });
725 }725 }
726726
727 mathExport("ceil", @import("./compiler_rt/ceil.zig"), true);727 mathExport("ceil", @import("./compiler_rt/ceil.zig"), false);
728 mathExport("cos", @import("./compiler_rt/cos.zig"), true);728 mathExport("cos", @import("./compiler_rt/cos.zig"), true);
729 mathExport("exp", @import("./compiler_rt/exp.zig"), true);729 mathExport("exp", @import("./compiler_rt/exp.zig"), true);
730 mathExport("exp2", @import("./compiler_rt/exp2.zig"), true);730 mathExport("exp2", @import("./compiler_rt/exp2.zig"), true);
731 mathExport("fabs", @import("./compiler_rt/fabs.zig"), true);731 mathExport("fabs", @import("./compiler_rt/fabs.zig"), true);
732 mathExport("floor", @import("./compiler_rt/floor.zig"), true);732 mathExport("floor", @import("./compiler_rt/floor.zig"), false);
733 mathExport("fma", @import("./compiler_rt/fma.zig"), true);733 mathExport("fma", @import("./compiler_rt/fma.zig"), true);
734 mathExport("fmax", @import("./compiler_rt/fmax.zig"), true);734 mathExport("fmax", @import("./compiler_rt/fmax.zig"), true);
735 mathExport("fmin", @import("./compiler_rt/fmin.zig"), true);735 mathExport("fmin", @import("./compiler_rt/fmin.zig"), true);
736 mathExport("fmod", @import("./compiler_rt/fmod.zig"), true);736 mathExport("fmod", @import("./compiler_rt/fmod.zig"), true);
737 mathExport("log", @import("./compiler_rt/log.zig"), true);737 mathExport("log", @import("./compiler_rt/log.zig"), true);
738 mathExport("log10", @import("./compiler_rt/log10.zig"), true);738 mathExport("log10", @import("./compiler_rt/log10.zig"), false);
739 mathExport("log2", @import("./compiler_rt/log2.zig"), true);739 mathExport("log2", @import("./compiler_rt/log2.zig"), true);
740 mathExport("round", @import("./compiler_rt/round.zig"), true);740 mathExport("round", @import("./compiler_rt/round.zig"), true);
741 mathExport("sin", @import("./compiler_rt/sin.zig"), true);741 mathExport("sin", @import("./compiler_rt/sin.zig"), true);
742 mathExport("sincos", @import("./compiler_rt/sincos.zig"), true);742 mathExport("sincos", @import("./compiler_rt/sincos.zig"), true);
743 mathExport("sqrt", @import("./compiler_rt/sqrt.zig"), true);743 mathExport("sqrt", @import("./compiler_rt/sqrt.zig"), true);
744 mathExport("tan", @import("./compiler_rt/tan.zig"), false);744 mathExport("tan", @import("./compiler_rt/tan.zig"), true);
745 mathExport("trunc", @import("./compiler_rt/trunc.zig"), true);745 mathExport("trunc", @import("./compiler_rt/trunc.zig"), true);
746746
747 if (arch.isSPARC()) {747 if (arch.isSPARC()) {
...@@ -825,7 +825,7 @@ comptime {...@@ -825,7 +825,7 @@ comptime {
825 }825 }
826}826}
827827
828inline fn mathExport(double_name: []const u8, comptime import: type, is_standard: bool) void {828inline fn mathExport(double_name: []const u8, comptime import: type, win_libc_has_it: bool) void {
829 const half_name = "__" ++ double_name ++ "h";829 const half_name = "__" ++ double_name ++ "h";
830 const half_fn = @field(import, half_name);830 const half_fn = @field(import, half_name);
831 const float_name = double_name ++ "f";831 const float_name = double_name ++ "f";
...@@ -855,7 +855,7 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard...@@ -855,7 +855,7 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard
855855
856 // Weak aliases don't work on Windows, so we avoid exporting the `l` alias856 // Weak aliases don't work on Windows, so we avoid exporting the `l` alias
857 // on this platform for functions we know will collide.857 // on this platform for functions we know will collide.
858 if (builtin.os.tag != .windows or !builtin.link_libc or !is_standard) {858 if (builtin.os.tag != .windows or !builtin.link_libc or !win_libc_has_it) {
859 inline for (pairs) |pair| {859 inline for (pairs) |pair| {
860 const F = pair[0];860 const F = pair[0];
861 const func = pair[1];861 const func = pair[1];
...@@ -865,7 +865,7 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard...@@ -865,7 +865,7 @@ inline fn mathExport(double_name: []const u8, comptime import: type, is_standard
865 }865 }
866 }866 }
867867
868 if (is_ppc and is_standard) {868 if (is_ppc) {
869 // LLVM PPC backend lowers f128 ops with the suffix `f128` instead of `l`.869 // LLVM PPC backend lowers f128 ops with the suffix `f128` instead of `l`.
870 @export(quad_fn, .{ .name = double_name ++ "f128", .linkage = linkage });870 @export(quad_fn, .{ .name = double_name ++ "f128", .linkage = linkage });
871 }871 }