Commit 429e542f3f
Changed files (2)
src
link
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;
}
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);