Skip to content

Commit 092352e

Browse files
committed
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.
1 parent 846571c commit 092352e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/c/common.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.
12-
pub const visibility: std.builtin.SymbolVisibility = if (builtin.cpu.arch.isWasm() and linkage != .internal)
12+
pub const visibility: std.builtin.SymbolVisibility = if (linkage != .internal)
1313
.hidden
1414
else
1515
.default;

lib/compiler_rt/common.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
16-
pub const visibility: std.builtin.SymbolVisibility =
17-
if (builtin.target.cpu.arch.isWasm() and linkage != .internal) .hidden else .default;
16+
pub const visibility: std.builtin.SymbolVisibility = if (linkage != .internal)
17+
.hidden
18+
else
19+
.default;
1820

1921
pub const PreferredLoadStoreElement = element: {
2022
if (std.simd.suggestVectorLength(u8)) |vec_size| {

0 commit comments

Comments
 (0)