Commit 5ef63e333a

Jakub Konka <kubkon@jakubkonka.com>
2024-01-18 20:40:47
macho: set atom_index for newly created Atom in ZigObject
1 parent 5d0ea3f
Changed files (2)
src
src/link/MachO/ZigObject.zig
@@ -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;
src/link/MachO.zig
@@ -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({})", .{