compiler-rt: Fix some exports to respect the common linkage and visibility.

This commit is contained in:
Alex Rønne Petersen
2025-05-18 22:20:55 +02:00
parent 092352ec63
commit 90fb2d9754
5 changed files with 116 additions and 118 deletions

View File

@@ -1,28 +1,27 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const os_tag = builtin.os.tag;
const arch = builtin.cpu.arch;
const abi = builtin.abi;
const is_test = builtin.is_test;
const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .weak;
const strong_linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .strong;
pub const panic = @import("common.zig").panic;
pub const panic = common.panic;
comptime {
if (builtin.os.tag == .windows) {
// Default stack-probe functions emitted by LLVM
if (builtin.target.isMinGW()) {
@export(&_chkstk, .{ .name = "_alloca", .linkage = linkage });
@export(&___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = linkage });
@export(&_chkstk, .{ .name = "_alloca", .linkage = common.linkage, .visibility = common.visibility });
@export(&___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = common.linkage, .visibility = common.visibility });
if (arch == .thumb or arch == .aarch64) {
@export(&__chkstk, .{ .name = "__chkstk", .linkage = linkage });
@export(&__chkstk, .{ .name = "__chkstk", .linkage = common.linkage, .visibility = common.visibility });
}
} else if (!builtin.link_libc) {
// This symbols are otherwise exported by MSVCRT.lib
@export(&_chkstk, .{ .name = "_chkstk", .linkage = linkage });
@export(&__chkstk, .{ .name = "__chkstk", .linkage = linkage });
@export(&_chkstk, .{ .name = "_chkstk", .linkage = common.linkage, .visibility = common.visibility });
@export(&__chkstk, .{ .name = "__chkstk", .linkage = common.linkage, .visibility = common.visibility });
}
}
@@ -30,7 +29,7 @@ comptime {
.x86,
.x86_64,
=> {
@export(&zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage });
@export(&zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = common.linkage, .visibility = common.visibility });
},
else => {},
}