macho: set atom_index for newly created Atom in ZigObject

This commit is contained in:
Jakub Konka 2024-01-18 20:40:47 +01:00
parent 5d0ea3fd27
commit 5ef63e333a
2 changed files with 8 additions and 0 deletions

View File

@ -3779,6 +3779,13 @@ fn fmtDumpState(
) !void {
_ = options;
_ = unused_fmt_string;
if (self.getZigObject()) |zo| {
try writer.print("zig_object({d}) : {s}\n", .{ zo.index, zo.path });
try writer.print("{}{}\n", .{
zo.fmtAtoms(self),
zo.fmtSymtab(self),
});
}
for (self.objects.items) |index| {
const object = self.getFile(index).?.object;
try writer.print("object({d}) : {} : has_debug({})", .{

View File

@ -110,6 +110,7 @@ pub fn addAtom(self: *ZigObject, macho_file: *MachO) !Symbol.Index {
const atom = macho_file.getAtom(atom_index).?;
atom.file = self.index;
atom.atom_index = atom_index;
const symbol = macho_file.getSymbol(symbol_index);
symbol.file = self.index;