authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-02-25 14:05:36+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-02-26 02:22:36+01:00
log429e542f3f25813a57abceda6ace715398eb0dd5
treed41dd2f711c5d9ee81ee08aab1f988cf1153517d
parent2901026425172be1f03c6eed544e8fabbdada4e0

macho: count rebases for synthetic __objc_selrefs


2 files changed, 5 insertions(+), 0 deletions(-)

src/link/MachO.zig+3
...@@ -2479,6 +2479,9 @@ fn initDyldInfoSections(self: *MachO) !void {...@@ -2479,6 +2479,9 @@ fn initDyldInfoSections(self: *MachO) !void {
2479 nbinds += ctx.bind_relocs;2479 nbinds += ctx.bind_relocs;
2480 nweak_binds += ctx.weak_bind_relocs;2480 nweak_binds += ctx.weak_bind_relocs;
2481 }2481 }
2482 if (self.getInternalObject()) |int| {
2483 nrebases += int.num_rebase_relocs;
2484 }
2482 try self.rebase.entries.ensureUnusedCapacity(gpa, nrebases);2485 try self.rebase.entries.ensureUnusedCapacity(gpa, nrebases);
2483 try self.bind.entries.ensureUnusedCapacity(gpa, nbinds);2486 try self.bind.entries.ensureUnusedCapacity(gpa, nbinds);
2484 try self.weak_bind.entries.ensureUnusedCapacity(gpa, nweak_binds);2487 try self.weak_bind.entries.ensureUnusedCapacity(gpa, nweak_binds);
src/link/MachO/InternalObject.zig+2
...@@ -8,6 +8,7 @@ strtab: std.ArrayListUnmanaged(u8) = .{},...@@ -8,6 +8,7 @@ strtab: std.ArrayListUnmanaged(u8) = .{},
8objc_methnames: std.ArrayListUnmanaged(u8) = .{},8objc_methnames: std.ArrayListUnmanaged(u8) = .{},
9objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64),9objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64),
1010
11num_rebase_relocs: u32 = 0,
11output_symtab_ctx: MachO.SymtabCtx = .{},12output_symtab_ctx: MachO.SymtabCtx = .{},
1213
13pub fn deinit(self: *InternalObject, allocator: Allocator) void {14pub fn deinit(self: *InternalObject, allocator: Allocator) void {
...@@ -115,6 +116,7 @@ fn addObjcSelrefsSection(...@@ -115,6 +116,7 @@ fn addObjcSelrefsSection(
115 },116 },
116 });117 });
117 atom.relocs = .{ .pos = 0, .len = 1 };118 atom.relocs = .{ .pos = 0, .len = 1 };
119 self.num_rebase_relocs += 1;
118120
119 return atom_index;121 return atom_index;
120}122}