| author | |
| committer | |
| log | 90c54f1eb6d34fb703b6c4e093580a0f2f70d559 |
| tree | 7e0a3416b09d81f61ac95c539b6fa22165a53822 |
| parent | 3d58faed12d018d70a4cd28aff89b733621a0259 |
3 files changed, 16 insertions(+), 3 deletions(-)
src/link/MachO/Object.zig+1-1| ... | ... | @@ -1536,7 +1536,7 @@ pub fn mergeSymbolVisibility(self: *Object, macho_file: *MachO) void { |
| 1536 | 1536 | for (self.symbols.items, 0..) |sym, i| { |
| 1537 | 1537 | const ref = self.getSymbolRef(@intCast(i), macho_file); |
| 1538 | 1538 | const global = ref.getSymbol(macho_file) orelse continue; |
| 1539 | if (global.visibility != .global) { | |
| 1539 | if (sym.visibility.rank() < global.visibility.rank()) { | |
| 1540 | 1540 | global.visibility = sym.visibility; |
| 1541 | 1541 | } |
| 1542 | 1542 | if (sym.flags.weak_ref) { |
src/link/MachO/Symbol.zig+14-1| ... | ... | @@ -331,9 +331,14 @@ fn format2( |
| 331 | 331 | if (symbol.getAtom(ctx.macho_file)) |atom| { |
| 332 | 332 | try writer.print(" : atom({d})", .{atom.atom_index}); |
| 333 | 333 | } |
| 334 | var buf: [2]u8 = .{'_'} ** 2; | |
| 334 | var buf: [3]u8 = .{'_'} ** 3; | |
| 335 | 335 | if (symbol.flags.@"export") buf[0] = 'E'; |
| 336 | 336 | if (symbol.flags.import) buf[1] = 'I'; |
| 337 | switch (symbol.visibility) { | |
| 338 | .local => buf[2] = 'L', | |
| 339 | .hidden => buf[2] = 'H', | |
| 340 | .global => buf[2] = 'G', | |
| 341 | } | |
| 337 | 342 | try writer.print(" : {s}", .{&buf}); |
| 338 | 343 | if (symbol.flags.weak) try writer.writeAll(" : weak"); |
| 339 | 344 | if (symbol.isSymbolStab(ctx.macho_file)) try writer.writeAll(" : stab"); |
| ... | ... | @@ -402,6 +407,14 @@ pub const Visibility = enum { |
| 402 | 407 | global, |
| 403 | 408 | hidden, |
| 404 | 409 | local, |
| 410 | ||
| 411 | pub fn rank(vis: Visibility) u2 { | |
| 412 | return switch (vis) { | |
| 413 | .local => 2, | |
| 414 | .hidden => 1, | |
| 415 | .global => 0, | |
| 416 | }; | |
| 417 | } | |
| 405 | 418 | }; |
| 406 | 419 | |
| 407 | 420 | pub const Extra = struct { |
src/link/MachO/ZigObject.zig+1-1| ... | ... | @@ -267,7 +267,7 @@ pub fn mergeSymbolVisibility(self: *ZigObject, macho_file: *MachO) void { |
| 267 | 267 | for (self.symbols.items, 0..) |sym, i| { |
| 268 | 268 | const ref = self.getSymbolRef(@intCast(i), macho_file); |
| 269 | 269 | const global = ref.getSymbol(macho_file) orelse continue; |
| 270 | if (global.visibility != .global) { | |
| 270 | if (sym.visibility.rank() < global.visibility.rank()) { | |
| 271 | 271 | global.visibility = sym.visibility; |
| 272 | 272 | } |
| 273 | 273 | if (sym.flags.weak_ref) { |