c: Use internal linkage when running tests.

This matches what we do for compiler-rt.
This commit is contained in:
Alex Rønne Petersen 2024-11-08 11:54:30 +01:00
parent 89a506a7ef
commit 9e1dd3dec2
No known key found for this signature in database

View File

@ -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 });
}
}