| ... | @@ -1550,6 +1550,11 @@ pub const Object = struct { | ... | @@ -1550,6 +1550,11 @@ pub const Object = struct { |
| 1550 | try o.flushTypePool(pt); | 1550 | try o.flushTypePool(pt); |
| 1551 | } | 1551 | } |
| 1552 | | 1552 | |
| | 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 | |
| 1553 | pub fn updateNav(o: *Object, pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) !void { | 1558 | pub fn updateNav(o: *Object, pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) !void { |
| 1554 | const zcu = o.zcu; | 1559 | const zcu = o.zcu; |
| 1555 | const ip = &zcu.intern_pool; | 1560 | const ip = &zcu.intern_pool; |
| ... | @@ -1622,14 +1627,14 @@ pub const Object = struct { | ... | @@ -1622,14 +1627,14 @@ pub const Object = struct { |
| 1622 | false => .default, | 1627 | false => .default, |
| 1623 | }; | 1628 | }; |
| 1624 | llvm_global.ptr(&o.builder).linkage = switch (@"extern".linkage) { | 1629 | 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, |
| 1626 | .strong => .external, | 1631 | .strong => .external, |
| 1627 | .weak => .extern_weak, | 1632 | .weak => .extern_weak, |
| 1628 | .link_once => unreachable, | 1633 | .link_once => unreachable, |
| 1629 | }; | 1634 | }; |
| 1630 | llvm_global.ptr(&o.builder).visibility = .fromSymbolVisibility(@"extern".visibility); | 1635 | llvm_global.ptr(&o.builder).visibility = .fromSymbolVisibility(@"extern".visibility); |
| 1631 | } else { | 1636 | } 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; |
| 1633 | llvm_global.ptr(&o.builder).visibility = .default; | 1638 | llvm_global.ptr(&o.builder).visibility = .default; |
| 1634 | llvm_global.ptr(&o.builder).dll_storage_class = .default; | 1639 | llvm_global.ptr(&o.builder).dll_storage_class = .default; |
| 1635 | llvm_global.ptr(&o.builder).unnamed_addr = .unnamed_addr; | 1640 | llvm_global.ptr(&o.builder).unnamed_addr = .unnamed_addr; |