| ... | @@ -406,14 +406,14 @@ pub fn flushModule(self: *Plan9, comp: *Compilation) !void { | ... | @@ -406,14 +406,14 @@ pub fn flushModule(self: *Plan9, comp: *Compilation) !void { |
| 406 | defer linecountinfo.deinit(); | 406 | defer linecountinfo.deinit(); |
| 407 | // text | 407 | // text |
| 408 | { | 408 | { |
| 409 | var linecount: u32 = 0; | 409 | var linecount: i64 = -1; |
| 410 | var it_file = self.fn_decl_table.iterator(); | 410 | var it_file = self.fn_decl_table.iterator(); |
| 411 | while (it_file.next()) |fentry| { | 411 | while (it_file.next()) |fentry| { |
| 412 | var it = fentry.value_ptr.functions.iterator(); | 412 | var it = fentry.value_ptr.functions.iterator(); |
| 413 | while (it.next()) |entry| { | 413 | while (it.next()) |entry| { |
| 414 | const decl = entry.key_ptr.*; | 414 | const decl = entry.key_ptr.*; |
| 415 | const out = entry.value_ptr.*; | 415 | const out = entry.value_ptr.*; |
| 416 | log.debug("write text decl {*} ({s}), lines {d} to {d}", .{ decl, decl.name, out.start_line, out.end_line }); | 416 | log.debug("write text decl {*} ({s}), lines {d} to {d}", .{ decl, decl.name, out.start_line + 1, out.end_line }); |
| 417 | { | 417 | { |
| 418 | // connect the previous decl to the next | 418 | // connect the previous decl to the next |
| 419 | const delta_line = @intCast(i32, out.start_line) - @intCast(i32, linecount); | 419 | const delta_line = @intCast(i32, out.start_line) - @intCast(i32, linecount); |
| ... | @@ -660,8 +660,7 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option | ... | @@ -660,8 +660,7 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 660 | } | 660 | } |
| 661 | | 661 | |
| 662 | pub fn writeSym(self: *Plan9, w: anytype, sym: aout.Sym) !void { | 662 | pub fn writeSym(self: *Plan9, w: anytype, sym: aout.Sym) !void { |
| 663 | log.debug("write sym.name: {s}", .{sym.name}); | 663 | log.debug("write sym{{name: {s}, value: {x}}}", .{ sym.name, sym.value }); |
| 664 | log.debug("write sym.value: {x}", .{sym.value}); | | |
| 665 | if (sym.type == .bad) return; // we don't want to write free'd symbols | 664 | if (sym.type == .bad) return; // we don't want to write free'd symbols |
| 666 | if (!self.sixtyfour_bit) { | 665 | if (!self.sixtyfour_bit) { |
| 667 | try w.writeIntBig(u32, @intCast(u32, sym.value)); | 666 | try w.writeIntBig(u32, @intCast(u32, sym.value)); |