Skip to content

Commit

Permalink
macho: make sure potential imports are not affected by export list
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Oct 23, 2024
1 parent 79668fa commit 12b8cea
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/MachO/Object.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1541,9 +1541,13 @@ pub fn mergeSymbolVisibility(self: *Object, macho_file: *MachO) void {
for (self.symbols.items, 0..) |sym, i| {
const ref = self.getSymbolRef(@intCast(i), macho_file);
const global = ref.getSymbol(macho_file) orelse continue;
if (macho_file.isMarkedForExport(global.getName(macho_file))) |is_export| {
global.visibility = if (is_export) .global else .hidden;
} else if (sym.visibility.rank() < global.visibility.rank()) {
if (global.getFile(macho_file).? != .dylib) {
if (macho_file.isMarkedForExport(global.getName(macho_file))) |is_export| {
global.visibility = if (is_export) .global else .hidden;
continue;
}
}
if (sym.visibility.rank() < global.visibility.rank()) {
global.visibility = sym.visibility;
}
if (sym.flags.weak_ref) {
Expand Down

0 comments on commit 12b8cea

Please sign in to comment.