authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-08 11:54:30+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-08 14:56:25+01:00
log9e1dd3dec2e8a74798b152b199ae6484c2fc1070
treeb17f9e6b3405a1795885d35c9256d8ef4aac9a1c
parent89a506a7efdf6934f2d17380cd98879c00e60824
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

c: Use internal linkage when running tests.

This matches what we do for compiler-rt.

1 files changed, 10 insertions(+), 8 deletions(-)

lib/c.zig+10-8
......@@ -11,6 +11,8 @@ const native_os = builtin.os.tag;
1111const native_arch = builtin.cpu.arch;
1212const native_abi = builtin.abi;
1313
14const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .strong;
15
1416const is_wasm = switch (native_arch) {
1517 .wasm32, .wasm64 => true,
1618 else => false,
......@@ -30,14 +32,14 @@ comptime {
3032 }
3133
3234 if (builtin.link_libc) {
33 @export(&strcmp, .{ .name = "strcmp", .linkage = .strong });
34 @export(&strncmp, .{ .name = "strncmp", .linkage = .strong });
35 @export(&strerror, .{ .name = "strerror", .linkage = .strong });
36 @export(&strlen, .{ .name = "strlen", .linkage = .strong });
37 @export(&strcpy, .{ .name = "strcpy", .linkage = .strong });
38 @export(&strncpy, .{ .name = "strncpy", .linkage = .strong });
39 @export(&strcat, .{ .name = "strcat", .linkage = .strong });
40 @export(&strncat, .{ .name = "strncat", .linkage = .strong });
35 @export(&strcmp, .{ .name = "strcmp", .linkage = linkage });
36 @export(&strncmp, .{ .name = "strncmp", .linkage = linkage });
37 @export(&strerror, .{ .name = "strerror", .linkage = linkage });
38 @export(&strlen, .{ .name = "strlen", .linkage = linkage });
39 @export(&strcpy, .{ .name = "strcpy", .linkage = linkage });
40 @export(&strncpy, .{ .name = "strncpy", .linkage = linkage });
41 @export(&strcat, .{ .name = "strcat", .linkage = linkage });
42 @export(&strncat, .{ .name = "strncat", .linkage = linkage });
4143 }
4244}
4345