authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-18 20:55:56+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-19 00:22:03+02:00
log092352ec63d3a4e9ff59a5d8ad8f119bf0eda468
treedf59739ecb008fb3412477964932933c7ec1d8bc
parent846571ce4e9840c278eb5bad1eb5221e84cf92de
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

compiler-rt, zigc: Use hidden visibility except when testing.

This prevents symbols from these libraries from polluting the dynamic symbol tables of binaries built with Zig. The downside is that we no longer deduplicate the symbols at run time due to weak linkage. Closes #7935. Closes #13303. Closes #19342.

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

lib/c/common.zig+1-1
......@@ -9,7 +9,7 @@ else
99/// Determines the symbol's visibility to other objects.
1010/// For WebAssembly this allows the symbol to be resolved to other modules, but will not
1111/// export it to the host runtime.
12pub const visibility: std.builtin.SymbolVisibility = if (builtin.cpu.arch.isWasm() and linkage != .internal)
12pub const visibility: std.builtin.SymbolVisibility = if (linkage != .internal)
1313 .hidden
1414else
1515 .default;
lib/compiler_rt/common.zig+4-2
......@@ -13,8 +13,10 @@ else
1313/// Determines the symbol's visibility to other objects.
1414/// For WebAssembly this allows the symbol to be resolved to other modules, but will not
1515/// export it to the host runtime.
16pub const visibility: std.builtin.SymbolVisibility =
17 if (builtin.target.cpu.arch.isWasm() and linkage != .internal) .hidden else .default;
16pub const visibility: std.builtin.SymbolVisibility = if (linkage != .internal)
17 .hidden
18else
19 .default;
1820
1921pub const PreferredLoadStoreElement = element: {
2022 if (std.simd.suggestVectorLength(u8)) |vec_size| {