diff --git a/src/MachO/Object.zig b/src/MachO/Object.zig index ef4a5441..11396213 100644 --- a/src/MachO/Object.zig +++ b/src/MachO/Object.zig @@ -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) {