commit 429e542f3f25813a57abceda6ace715398eb0dd5 (tree)
parent 2901026425172be1f03c6eed544e8fabbdada4e0
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Sun, 25 Feb 2024 14:05:36 +0100
macho: count rebases for synthetic __objc_selrefs
Diffstat:
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
@@ -2479,6 +2479,9 @@ fn initDyldInfoSections(self: *MachO) !void {
nbinds += ctx.bind_relocs;
nweak_binds += ctx.weak_bind_relocs;
}
+ if (self.getInternalObject()) |int| {
+ nrebases += int.num_rebase_relocs;
+ }
try self.rebase.entries.ensureUnusedCapacity(gpa, nrebases);
try self.bind.entries.ensureUnusedCapacity(gpa, nbinds);
try self.weak_bind.entries.ensureUnusedCapacity(gpa, nweak_binds);
diff --git a/src/link/MachO/InternalObject.zig b/src/link/MachO/InternalObject.zig
@@ -8,6 +8,7 @@ strtab: std.ArrayListUnmanaged(u8) = .{},
objc_methnames: std.ArrayListUnmanaged(u8) = .{},
objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64),
+num_rebase_relocs: u32 = 0,
output_symtab_ctx: MachO.SymtabCtx = .{},
pub fn deinit(self: *InternalObject, allocator: Allocator) void {
@@ -115,6 +116,7 @@ fn addObjcSelrefsSection(
},
});
atom.relocs = .{ .pos = 0, .len = 1 };
+ self.num_rebase_relocs += 1;
return atom_index;
}