authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-12-06 00:00:50+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-12-06 00:00:50+01:00
log3ac973c7068f540fa46c0939d3c4bb712b407d37
tree54e025fa2bc67ec0e51d31dd51bc48ec9d504fa2
parent124e94271479876da74bbfe358d12c9ea0215be0

macho: fix incremental codepath for linking objects


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

src/link/MachO.zig+7-7
......@@ -2551,8 +2551,6 @@ fn createDsoHandleAtom(self: *MachO) !void {
25512551 const vaddr = try self.allocateAtom(atom, 0, 1, match);
25522552 sym.n_value = vaddr;
25532553 } else try self.addAtomAndBumpSectionSize(atom, match);
2554
2555 atom.dirty = false; // We don't really want to write it to file.
25562554 }
25572555}
25582556
......@@ -2898,7 +2896,6 @@ fn createMhExecuteHeaderAtom(self: *MachO) !void {
28982896 sym.n_value = vaddr;
28992897 } else try self.addAtomAndBumpSectionSize(atom, match);
29002898
2901 atom.dirty = false;
29022899 self.mh_execute_header_index = local_sym_index;
29032900}
29042901
......@@ -2963,6 +2960,8 @@ fn resolveDyldStubBinder(self: *MachO) !void {
29632960}
29642961
29652962fn parseObjectsIntoAtoms(self: *MachO) !void {
2963 // TODO I need to see if I can simplify this logic, or perhaps split it into two functions:
2964 // one for non-prealloc traditional path, and one for incremental prealloc path.
29662965 const tracy = trace(@src());
29672966 defer tracy.end();
29682967
......@@ -3078,6 +3077,11 @@ fn parseObjectsIntoAtoms(self: *MachO) !void {
30783077 };
30793078 if (!section_metadata.contains(match)) continue;
30803079
3080 var base_vaddr = if (self.atoms.get(match)) |last| blk: {
3081 const last_atom_sym = self.locals.items[last.local_sym_index];
3082 break :blk last_atom_sym.n_value + last.size;
3083 } else sect.addr;
3084
30813085 if (self.atoms.getPtr(match)) |last| {
30823086 const first_atom = first_atoms.get(match).?;
30833087 last.*.next = first_atom;
......@@ -3088,10 +3092,6 @@ fn parseObjectsIntoAtoms(self: *MachO) !void {
30883092
30893093 if (!self.needs_prealloc) continue;
30903094
3091 var base_vaddr = if (self.atoms.get(match)) |last| blk: {
3092 const last_atom_sym = self.locals.items[last.local_sym_index];
3093 break :blk last_atom_sym.n_value + last.size;
3094 } else sect.addr;
30953095 const n_sect = @intCast(u8, self.section_ordinals.getIndex(match).? + 1);
30963096
30973097 var atom = first_atoms.get(match).?;