authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-26 00:56:38+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-26 08:04:15+02:00
logb3747dd707eeaf06e0bacbde259bf71ef525a961
tree7af396218c0adfaf3c62da7a14d499fa60bf1a7a
parent2625e42a6860efdfe377bd48446c5cd103e7ac1a

llvm: work around upstream aarch64-windows bug for private thread_local symbols

https://codeberg.org/ziglang/zig/issues/31865

1 files changed, 7 insertions(+), 2 deletions(-)

src/codegen/llvm.zig+7-2
......@@ -1550,6 +1550,11 @@ pub const Object = struct {
15501550 try o.flushTypePool(pt);
15511551 }
15521552
1553 fn workaroundPrivateSymbolBugs(target: *const std.Target, resolved: *const InternPool.Nav.Resolved) bool {
1554 // https://codeberg.org/ziglang/zig/issues/31865
1555 return target.cpu.arch.isAARCH64() and target.ofmt == .coff and resolved.@"threadlocal";
1556 }
1557
15531558 pub fn updateNav(o: *Object, pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) !void {
15541559 const zcu = o.zcu;
15551560 const ip = &zcu.intern_pool;
......@@ -1622,14 +1627,14 @@ pub const Object = struct {
16221627 false => .default,
16231628 };
16241629 llvm_global.ptr(&o.builder).linkage = switch (@"extern".linkage) {
1625 .internal => if (o.builder.strip) .private else .internal,
1630 .internal => if (o.builder.strip and !workaroundPrivateSymbolBugs(zcu.getTarget(), &resolved)) .private else .internal,
16261631 .strong => .external,
16271632 .weak => .extern_weak,
16281633 .link_once => unreachable,
16291634 };
16301635 llvm_global.ptr(&o.builder).visibility = .fromSymbolVisibility(@"extern".visibility);
16311636 } else {
1632 llvm_global.ptr(&o.builder).linkage = if (o.builder.strip) .private else .internal;
1637 llvm_global.ptr(&o.builder).linkage = if (o.builder.strip and !workaroundPrivateSymbolBugs(zcu.getTarget(), &resolved)) .private else .internal;
16331638 llvm_global.ptr(&o.builder).visibility = .default;
16341639 llvm_global.ptr(&o.builder).dll_storage_class = .default;
16351640 llvm_global.ptr(&o.builder).unnamed_addr = .unnamed_addr;