diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-07-04 17:49:35 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2024-07-18 09:13:07 +0200 |
| commit | 101299e85625faf29b4afce07ad1e3522ea75421 (patch) | |
| tree | 365fb3864b1e6a35ff99ba4b81b22ed0963773f9 /src/link/MachO/Atom.zig | |
| parent | a57479afc2cea1b7c2c6802b7e8a1a7db973a3a3 (diff) | |
| download | zig-101299e85625faf29b4afce07ad1e3522ea75421.tar.gz zig-101299e85625faf29b4afce07ad1e3522ea75421.zip | |
macho: move unwind info records ownership to Objects
Diffstat (limited to 'src/link/MachO/Atom.zig')
| -rw-r--r-- | src/link/MachO/Atom.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig index 1a315330e3..c0a53da7e4 100644 --- a/src/link/MachO/Atom.zig +++ b/src/link/MachO/Atom.zig @@ -91,14 +91,16 @@ pub fn getUnwindRecords(self: Atom, macho_file: *MachO) []const UnwindInfo.Recor if (!self.flags.unwind) return &[0]UnwindInfo.Record.Index{}; const extra = self.getExtra(macho_file).?; return switch (self.getFile(macho_file)) { - .dylib, .zig_object, .internal => unreachable, - .object => |x| x.unwind_records.items[extra.unwind_index..][0..extra.unwind_count], + .dylib => unreachable, + .zig_object, .internal => &[0]UnwindInfo.Record.Index{}, + .object => |x| x.unwind_records_indexes.items[extra.unwind_index..][0..extra.unwind_count], }; } pub fn markUnwindRecordsDead(self: Atom, macho_file: *MachO) void { + const object = self.getFile(macho_file).object; for (self.getUnwindRecords(macho_file)) |cu_index| { - const cu = macho_file.getUnwindRecord(cu_index); + const cu = object.getUnwindRecord(cu_index); cu.alive = false; if (cu.getFdePtr(macho_file)) |fde| { @@ -1170,6 +1172,7 @@ fn format2( _ = unused_fmt_string; const atom = ctx.atom; const macho_file = ctx.macho_file; + const file = atom.getFile(macho_file); try writer.print("atom({d}) : {s} : @{x} : sect({d}) : align({x}) : size({x}) : nreloc({d})", .{ atom.atom_index, atom.getName(macho_file), atom.getAddress(macho_file), atom.out_n_sect, atom.alignment, atom.size, @@ -1181,7 +1184,7 @@ fn format2( try writer.writeAll(" : unwind{ "); const extra = atom.getExtra(macho_file).?; for (atom.getUnwindRecords(macho_file), extra.unwind_index..) |index, i| { - const rec = macho_file.getUnwindRecord(index); + const rec = file.object.getUnwindRecord(index); try writer.print("{d}", .{index}); if (!rec.alive) try writer.writeAll("([*])"); if (i < extra.unwind_index + extra.unwind_count - 1) try writer.writeAll(", "); |
