authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-21 17:17:30-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-23 16:27:39-07:00
log1c459032743caff33fad7d8d24471baafc0306a0
tree671217a23228df7790f28d81522ffd9c691e50b9
parent22948616ff8da42f9ae9d7b292d80a01537f2a7e

handle _fltused in compiler_rt

so we don't have to do an entire compilation unit for just this silly symbol

2 files changed, 8 insertions(+), 5 deletions(-)

lib/c.zig-4
...@@ -38,8 +38,6 @@ comptime {...@@ -38,8 +38,6 @@ comptime {
38 @export(&strncpy, .{ .name = "strncpy", .linkage = .strong });38 @export(&strncpy, .{ .name = "strncpy", .linkage = .strong });
39 @export(&strcat, .{ .name = "strcat", .linkage = .strong });39 @export(&strcat, .{ .name = "strcat", .linkage = .strong });
40 @export(&strncat, .{ .name = "strncat", .linkage = .strong });40 @export(&strncat, .{ .name = "strncat", .linkage = .strong });
41 } else if (is_msvc) {
42 @export(&_fltused, .{ .name = "_fltused", .linkage = .strong });
43 }41 }
44}42}
4543
...@@ -62,8 +60,6 @@ fn wasm_start() callconv(.C) void {...@@ -62,8 +60,6 @@ fn wasm_start() callconv(.C) void {
62 _ = main(0, undefined);60 _ = main(0, undefined);
63}61}
6462
65var _fltused: c_int = 1;
66
67fn strcpy(dest: [*:0]u8, src: [*:0]const u8) callconv(.C) [*:0]u8 {63fn strcpy(dest: [*:0]u8, src: [*:0]const u8) callconv(.C) [*:0]u8 {
68 var i: usize = 0;64 var i: usize = 0;
69 while (src[i] != 0) : (i += 1) {65 while (src[i] != 0) : (i += 1) {
lib/compiler_rt.zig+8-1
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("compiler_rt/common.zig");
23
3pub const panic = @import("compiler_rt/common.zig").panic;4pub const panic = common.panic;
45
5comptime {6comptime {
6 // Integer routines7 // Integer routines
...@@ -236,4 +237,10 @@ comptime {...@@ -236,4 +237,10 @@ comptime {
236 _ = @import("compiler_rt/bcmp.zig");237 _ = @import("compiler_rt/bcmp.zig");
237 _ = @import("compiler_rt/ssp.zig");238 _ = @import("compiler_rt/ssp.zig");
238 }239 }
240
241 if (!builtin.link_libc and builtin.abi == .msvc) {
242 @export(&_fltused, .{ .name = "_fltused", .linkage = common.linkage, .visibility = common.visibility });
243 }
239}244}
245
246var _fltused: c_int = 1;