authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-07-15 08:05:07+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-07-18 09:13:08+02:00
log521933e1c05977105ee4eee70096a13064068f8b
tree852278a7b668224cfa1851d5bfd3d7ca19d1dcb5
parentf9fbd6302f0f4d1ef5ed1c1d2fc63eabb313978d

macho: do not randomly append non-incr atoms in ZigObject


1 files changed, 1 insertions(+), 5 deletions(-)

src/link/MachO/ZigObject.zig+1-5
...@@ -497,6 +497,7 @@ pub fn writeAtomsRelocatable(self: *ZigObject, macho_file: *MachO) !void {...@@ -497,6 +497,7 @@ pub fn writeAtomsRelocatable(self: *ZigObject, macho_file: *MachO) !void {
497 const sect = atom.getInputSection(macho_file);497 const sect = atom.getInputSection(macho_file);
498 if (sect.isZerofill()) continue;498 if (sect.isZerofill()) continue;
499 if (macho_file.isZigSection(atom.out_n_sect)) continue;499 if (macho_file.isZigSection(atom.out_n_sect)) continue;
500 if (atom.getRelocs(macho_file).len == 0) continue;
500 const off = atom.value;501 const off = atom.value;
501 const buffer = macho_file.sections.items(.out)[atom.out_n_sect].items;502 const buffer = macho_file.sections.items(.out)[atom.out_n_sect].items;
502 try self.getAtomData(macho_file, atom.*, buffer[off..][0..atom.size]);503 try self.getAtomData(macho_file, atom.*, buffer[off..][0..atom.size]);
...@@ -1175,11 +1176,6 @@ fn createTlvDescriptor(...@@ -1175,11 +1176,6 @@ fn createTlvDescriptor(
1175 .symbolnum = @intCast(init_sym_index),1176 .symbolnum = @intCast(init_sym_index),
1176 },1177 },
1177 });1178 });
1178
1179 try macho_file.sections.items(.atoms)[sect_index].append(gpa, .{
1180 .index = atom.atom_index,
1181 .file = self.index,
1182 });
1183}1179}
11841180
1185fn getDeclOutputSection(1181fn getDeclOutputSection(