authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-03-17 11:41:08+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-03-17 11:41:08+01:00
logd53e0234a35560e611a808f30ec33541e7900893
tree1e2327c68e5a0357c6d8f87c1f3bf309e5d5f859
parent648afbc839c8f367f42affd8a6ce8dce8e70a795

macho: fix snapshot generation


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

src/link/MachO.zig+17-1
......@@ -6441,6 +6441,21 @@ fn snapshotState(self: *MachO) !void {
64416441
64426442 while (true) {
64436443 const atom_sym = self.locals.items[atom.local_sym_index];
6444 const should_skip_atom: bool = blk: {
6445 if (self.mh_execute_header_index) |index| {
6446 if (index == atom.local_sym_index) break :blk true;
6447 }
6448 if (mem.eql(u8, self.getString(atom_sym.n_strx), "___dso_handle")) break :blk true;
6449 break :blk false;
6450 };
6451
6452 if (should_skip_atom) {
6453 if (atom.next) |next| {
6454 atom = next;
6455 } else break;
6456 continue;
6457 }
6458
64446459 var node = Snapshot.Node{
64456460 .address = atom_sym.n_value,
64466461 .tag = .atom_start,
......@@ -6480,7 +6495,8 @@ fn snapshotState(self: *MachO) !void {
64806495 };
64816496
64826497 if (is_via_got) {
6483 const got_atom = self.got_entries_table.get(rel.target) orelse break :blk 0;
6498 const got_index = self.got_entries_table.get(rel.target) orelse break :blk 0;
6499 const got_atom = self.got_entries.items[got_index].atom;
64846500 break :blk self.locals.items[got_atom.local_sym_index].n_value;
64856501 }
64866502