diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-11-08 11:54:30 +0100 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2024-11-08 14:56:25 +0100 |
| commit | 9e1dd3dec2e8a74798b152b199ae6484c2fc1070 (patch) | |
| tree | b17f9e6b3405a1795885d35c9256d8ef4aac9a1c /lib | |
| parent | 89a506a7efdf6934f2d17380cd98879c00e60824 (diff) | |
| download | zig-9e1dd3dec2e8a74798b152b199ae6484c2fc1070.tar.gz zig-9e1dd3dec2e8a74798b152b199ae6484c2fc1070.zip | |
c: Use internal linkage when running tests.
This matches what we do for compiler-rt.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/c.zig | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -11,6 +11,8 @@ const native_os = builtin.os.tag; const native_arch = builtin.cpu.arch; const native_abi = builtin.abi; +const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .strong; + const is_wasm = switch (native_arch) { .wasm32, .wasm64 => true, else => false, @@ -30,14 +32,14 @@ comptime { } if (builtin.link_libc) { - @export(&strcmp, .{ .name = "strcmp", .linkage = .strong }); - @export(&strncmp, .{ .name = "strncmp", .linkage = .strong }); - @export(&strerror, .{ .name = "strerror", .linkage = .strong }); - @export(&strlen, .{ .name = "strlen", .linkage = .strong }); - @export(&strcpy, .{ .name = "strcpy", .linkage = .strong }); - @export(&strncpy, .{ .name = "strncpy", .linkage = .strong }); - @export(&strcat, .{ .name = "strcat", .linkage = .strong }); - @export(&strncat, .{ .name = "strncat", .linkage = .strong }); + @export(&strcmp, .{ .name = "strcmp", .linkage = linkage }); + @export(&strncmp, .{ .name = "strncmp", .linkage = linkage }); + @export(&strerror, .{ .name = "strerror", .linkage = linkage }); + @export(&strlen, .{ .name = "strlen", .linkage = linkage }); + @export(&strcpy, .{ .name = "strcpy", .linkage = linkage }); + @export(&strncpy, .{ .name = "strncpy", .linkage = linkage }); + @export(&strcat, .{ .name = "strcat", .linkage = linkage }); + @export(&strncat, .{ .name = "strncat", .linkage = linkage }); } } |
