srctree

Jakub Konka parent 29010264 429e542f
macho: count rebases for synthetic __objc_selrefs

inlinesplit
src/link/MachO.zig added: 7, removed: 2, total 5
@@ -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);
 
src/link/MachO/InternalObject.zig added: 7, removed: 2, total 5
@@ -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;
}