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...@@ -9,7 +9,7 @@ else
9/// Determines the symbol's visibility to other objects.9/// Determines the symbol's visibility to other objects.
10/// For WebAssembly this allows the symbol to be resolved to other modules, but will not10/// For WebAssembly this allows the symbol to be resolved to other modules, but will not
11/// export it to the host runtime.11/// 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)
13 .hidden13 .hidden
14else14else
15 .default;15 .default;
lib/compiler_rt/common.zig+4-2
...@@ -13,8 +13,10 @@ else...@@ -13,8 +13,10 @@ else
13/// Determines the symbol's visibility to other objects.13/// Determines the symbol's visibility to other objects.
14/// For WebAssembly this allows the symbol to be resolved to other modules, but will not14/// For WebAssembly this allows the symbol to be resolved to other modules, but will not
15/// export it to the host runtime.15/// export it to the host runtime.
16pub const visibility: std.builtin.SymbolVisibility =16pub const visibility: std.builtin.SymbolVisibility = if (linkage != .internal)
17 if (builtin.target.cpu.arch.isWasm() and linkage != .internal) .hidden else .default;17 .hidden
18else
19 .default;
1820
19pub const PreferredLoadStoreElement = element: {21pub const PreferredLoadStoreElement = element: {
20 if (std.simd.suggestVectorLength(u8)) |vec_size| {22 if (std.simd.suggestVectorLength(u8)) |vec_size| {