| ... | @@ -1455,7 +1455,7 @@ pub fn createTentativeDefAtoms(self: *MachO) !void { | ... | @@ -1455,7 +1455,7 @@ pub fn createTentativeDefAtoms(self: *MachO) !void { |
| 1455 | } | 1455 | } |
| 1456 | } | 1456 | } |
| 1457 | | 1457 | |
| 1458 | fn createDyldPrivateAtom(self: *MachO) !void { | 1458 | pub fn createDyldPrivateAtom(self: *MachO) !void { |
| 1459 | if (self.dyld_private_atom_index != null) return; | 1459 | if (self.dyld_private_atom_index != null) return; |
| 1460 | | 1460 | |
| 1461 | const sym_index = try self.allocateSymbol(); | 1461 | const sym_index = try self.allocateSymbol(); |
| ... | @@ -2015,7 +2015,7 @@ fn growAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignment: | ... | @@ -2015,7 +2015,7 @@ fn growAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignment: |
| 2015 | return self.allocateAtom(atom_index, new_atom_size, alignment); | 2015 | return self.allocateAtom(atom_index, new_atom_size, alignment); |
| 2016 | } | 2016 | } |
| 2017 | | 2017 | |
| 2018 | fn allocateSymbol(self: *MachO) !u32 { | 2018 | pub fn allocateSymbol(self: *MachO) !u32 { |
| 2019 | try self.locals.ensureUnusedCapacity(self.base.allocator, 1); | 2019 | try self.locals.ensureUnusedCapacity(self.base.allocator, 1); |
| 2020 | | 2020 | |
| 2021 | const index = blk: { | 2021 | const index = blk: { |
| ... | @@ -2104,7 +2104,7 @@ pub fn addStubEntry(self: *MachO, target: SymbolWithLoc) !void { | ... | @@ -2104,7 +2104,7 @@ pub fn addStubEntry(self: *MachO, target: SymbolWithLoc) !void { |
| 2104 | | 2104 | |
| 2105 | pub fn addTlvPtrEntry(self: *MachO, target: SymbolWithLoc) !void { | 2105 | pub fn addTlvPtrEntry(self: *MachO, target: SymbolWithLoc) !void { |
| 2106 | if (self.tlv_ptr_table.lookup.contains(target)) return; | 2106 | if (self.tlv_ptr_table.lookup.contains(target)) return; |
| 2107 | _ = try self.tlv_ptr_table.allocateEntry(self.gpa, target); | 2107 | _ = try self.tlv_ptr_table.allocateEntry(self.base.allocator, target); |
| 2108 | if (self.tlv_ptr_section_index == null) { | 2108 | if (self.tlv_ptr_section_index == null) { |
| 2109 | self.tlv_ptr_section_index = try self.initSection("__DATA", "__thread_ptrs", .{ | 2109 | self.tlv_ptr_section_index = try self.initSection("__DATA", "__thread_ptrs", .{ |
| 2110 | .flags = macho.S_THREAD_LOCAL_VARIABLE_POINTERS, | 2110 | .flags = macho.S_THREAD_LOCAL_VARIABLE_POINTERS, |
| ... | @@ -3490,7 +3490,7 @@ fn collectRebaseData(self: *MachO, rebase: *Rebase) !void { | ... | @@ -3490,7 +3490,7 @@ fn collectRebaseData(self: *MachO, rebase: *Rebase) !void { |
| 3490 | const offset = @as(u64, @intCast(base_offset + rel_offset)); | 3490 | const offset = @as(u64, @intCast(base_offset + rel_offset)); |
| 3491 | log.debug(" | rebase at {x}", .{offset}); | 3491 | log.debug(" | rebase at {x}", .{offset}); |
| 3492 | | 3492 | |
| 3493 | try rebase.entries.append(self.gpa, .{ | 3493 | try rebase.entries.append(gpa, .{ |
| 3494 | .offset = offset, | 3494 | .offset = offset, |
| 3495 | .segment_id = segment_id, | 3495 | .segment_id = segment_id, |
| 3496 | }); | 3496 | }); |
| ... | @@ -3656,7 +3656,7 @@ fn collectBindData(self: *MachO, bind: anytype, raw_bindings: anytype) !void { | ... | @@ -3656,7 +3656,7 @@ fn collectBindData(self: *MachO, bind: anytype, raw_bindings: anytype) !void { |
| 3656 | if (bind_sym.weakRef()) { | 3656 | if (bind_sym.weakRef()) { |
| 3657 | log.debug(" | marking as weak ref ", .{}); | 3657 | log.debug(" | marking as weak ref ", .{}); |
| 3658 | } | 3658 | } |
| 3659 | try bind.entries.append(self.gpa, .{ | 3659 | try bind.entries.append(gpa, .{ |
| 3660 | .target = global, | 3660 | .target = global, |
| 3661 | .offset = offset, | 3661 | .offset = offset, |
| 3662 | .segment_id = segment_id, | 3662 | .segment_id = segment_id, |
| ... | @@ -4004,8 +4004,8 @@ fn writeSymtab(self: *MachO) !SymtabCtx { | ... | @@ -4004,8 +4004,8 @@ fn writeSymtab(self: *MachO) !SymtabCtx { |
| 4004 | var locals = std.ArrayList(macho.nlist_64).init(gpa); | 4004 | var locals = std.ArrayList(macho.nlist_64).init(gpa); |
| 4005 | defer locals.deinit(); | 4005 | defer locals.deinit(); |
| 4006 | | 4006 | |
| 4007 | for (0..self.locals.items) |sym_id| { | 4007 | for (0..self.locals.items.len) |sym_id| { |
| 4008 | try self.addLocalToSymtab(.{ .sym_index = @intCast(sym_id) }); | 4008 | try self.addLocalToSymtab(.{ .sym_index = @intCast(sym_id) }, &locals); |
| 4009 | } | 4009 | } |
| 4010 | | 4010 | |
| 4011 | for (self.objects.items) |object| { | 4011 | for (self.objects.items) |object| { |
| ... | @@ -4611,7 +4611,7 @@ pub fn makeStaticString(bytes: []const u8) [16]u8 { | ... | @@ -4611,7 +4611,7 @@ pub fn makeStaticString(bytes: []const u8) [16]u8 { |
| 4611 | return buf; | 4611 | return buf; |
| 4612 | } | 4612 | } |
| 4613 | | 4613 | |
| 4614 | fn getSegmentByName(self: MachO, segname: []const u8) ?u8 { | 4614 | pub fn getSegmentByName(self: MachO, segname: []const u8) ?u8 { |
| 4615 | for (self.segments.items, 0..) |seg, i| { | 4615 | for (self.segments.items, 0..) |seg, i| { |
| 4616 | if (mem.eql(u8, segname, seg.segName())) return @as(u8, @intCast(i)); | 4616 | if (mem.eql(u8, segname, seg.segName())) return @as(u8, @intCast(i)); |
| 4617 | } else return null; | 4617 | } else return null; |
| ... | @@ -5024,7 +5024,7 @@ pub fn logSymtab(self: *MachO) void { | ... | @@ -5024,7 +5024,7 @@ pub fn logSymtab(self: *MachO) void { |
| 5024 | scoped_log.debug("{}", .{self.tlv_ptr_table}); | 5024 | scoped_log.debug("{}", .{self.tlv_ptr_table}); |
| 5025 | | 5025 | |
| 5026 | scoped_log.debug("stubs entries:", .{}); | 5026 | scoped_log.debug("stubs entries:", .{}); |
| 5027 | scoped_log.debug("{}", .{self.stubs_table}); | 5027 | scoped_log.debug("{}", .{self.stub_table}); |
| 5028 | | 5028 | |
| 5029 | scoped_log.debug("thunks:", .{}); | 5029 | scoped_log.debug("thunks:", .{}); |
| 5030 | for (self.thunks.items, 0..) |thunk, i| { | 5030 | for (self.thunks.items, 0..) |thunk, i| { |
| ... | @@ -5151,7 +5151,7 @@ const Cache = std.Build.Cache; | ... | @@ -5151,7 +5151,7 @@ const Cache = std.Build.Cache; |
| 5151 | const CodeSignature = @import("MachO/CodeSignature.zig"); | 5151 | const CodeSignature = @import("MachO/CodeSignature.zig"); |
| 5152 | const Compilation = @import("../Compilation.zig"); | 5152 | const Compilation = @import("../Compilation.zig"); |
| 5153 | const Dwarf = File.Dwarf; | 5153 | const Dwarf = File.Dwarf; |
| 5154 | const DwarfInfo = @import("DwarfInfo.zig"); | 5154 | const DwarfInfo = @import("MachO/DwarfInfo.zig"); |
| 5155 | const Dylib = @import("MachO/Dylib.zig"); | 5155 | const Dylib = @import("MachO/Dylib.zig"); |
| 5156 | const File = link.File; | 5156 | const File = link.File; |
| 5157 | const Object = @import("MachO/Object.zig"); | 5157 | const Object = @import("MachO/Object.zig"); |
| ... | @@ -5170,10 +5170,9 @@ const TypedValue = @import("../TypedValue.zig"); | ... | @@ -5170,10 +5170,9 @@ const TypedValue = @import("../TypedValue.zig"); |
| 5170 | const Value = @import("../value.zig").Value; | 5170 | const Value = @import("../value.zig").Value; |
| 5171 | | 5171 | |
| 5172 | pub const DebugSymbols = @import("MachO/DebugSymbols.zig"); | 5172 | pub const DebugSymbols = @import("MachO/DebugSymbols.zig"); |
| 5173 | | 5173 | pub const Bind = @import("MachO/dyld_info/bind.zig").Bind(*const MachO, SymbolWithLoc); |
| 5174 | const Bind = @import("MachO/dyld_info/bind.zig").Bind(*const MachO, SymbolWithLoc); | 5174 | pub const LazyBind = @import("MachO/dyld_info/bind.zig").LazyBind(*const MachO, SymbolWithLoc); |
| 5175 | const LazyBind = @import("MachO/dyld_info/bind.zig").LazyBind(*const MachO, SymbolWithLoc); | 5175 | pub const Rebase = @import("MachO/dyld_info/Rebase.zig"); |
| 5176 | const Rebase = @import("MachO/dyld_info/Rebase.zig"); | | |
| 5177 | | 5176 | |
| 5178 | pub const base_tag: File.Tag = File.Tag.macho; | 5177 | pub const base_tag: File.Tag = File.Tag.macho; |
| 5179 | pub const N_DEAD: u16 = @as(u16, @bitCast(@as(i16, -1))); | 5178 | pub const N_DEAD: u16 = @as(u16, @bitCast(@as(i16, -1))); |
| ... | @@ -5257,7 +5256,7 @@ const UnnamedConstTable = std.AutoArrayHashMapUnmanaged(Module.Decl.Index, std.A | ... | @@ -5257,7 +5256,7 @@ const UnnamedConstTable = std.AutoArrayHashMapUnmanaged(Module.Decl.Index, std.A |
| 5257 | const RebaseTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(u32)); | 5256 | const RebaseTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(u32)); |
| 5258 | const RelocationTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Relocation)); | 5257 | const RelocationTable = std.AutoArrayHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Relocation)); |
| 5259 | | 5258 | |
| 5260 | const ResolveAction = struct { | 5259 | pub const ResolveAction = struct { |
| 5261 | kind: Kind, | 5260 | kind: Kind, |
| 5262 | target: SymbolWithLoc, | 5261 | target: SymbolWithLoc, |
| 5263 | | 5262 | |