From 521933e1c05977105ee4eee70096a13064068f8b Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 15 Jul 2024 08:05:07 +0200 Subject: [PATCH] macho: do not randomly append non-incr atoms in ZigObject --- src/link/MachO/ZigObject.zig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 1cf95e404d..680f19a245 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -497,6 +497,7 @@ pub fn writeAtomsRelocatable(self: *ZigObject, macho_file: *MachO) !void { const sect = atom.getInputSection(macho_file); if (sect.isZerofill()) continue; if (macho_file.isZigSection(atom.out_n_sect)) continue; + if (atom.getRelocs(macho_file).len == 0) continue; const off = atom.value; const buffer = macho_file.sections.items(.out)[atom.out_n_sect].items; try self.getAtomData(macho_file, atom.*, buffer[off..][0..atom.size]); @@ -1175,11 +1176,6 @@ fn createTlvDescriptor( .symbolnum = @intCast(init_sym_index), }, }); - - try macho_file.sections.items(.atoms)[sect_index].append(gpa, .{ - .index = atom.atom_index, - .file = self.index, - }); } fn getDeclOutputSection(