| author | |
| committer | |
| log | d66c97d0ef0434ce0814d1921877b9ffa877a645 |
| tree | 16cb2357467b5b70d82f34ca93c97f973c7adeb6 |
| parent | 2a39d8063d99cd2a2437c581ed9996578faa9a63 |
| parent | 398c0b10e47f179b58195d4923985d4023854852 |
| signature |
Plan9 zig test3 files changed, 35 insertions(+), 3 deletions(-)
src/arch/x86_64/Isel.zig+10-1| ... | ... | @@ -753,7 +753,16 @@ fn dbgAdvancePCAndLine(isel: *Isel, line: u32, column: u32) InnerError!void { |
| 753 | 753 | const d_pc_p9 = @intCast(i64, delta_pc) - quant; |
| 754 | 754 | if (d_pc_p9 > 0) { |
| 755 | 755 | // minus one because if its the last one, we want to leave space to change the line which is one quanta |
| 756 | try dbg_out.dbg_line.append(@intCast(u8, @divExact(d_pc_p9, quant) + 128) - quant); | |
| 756 | var diff = @divExact(d_pc_p9, quant) - quant; | |
| 757 | while (diff > 0) { | |
| 758 | if (diff < 64) { | |
| 759 | try dbg_out.dbg_line.append(@intCast(u8, diff + 128)); | |
| 760 | diff = 0; | |
| 761 | } else { | |
| 762 | try dbg_out.dbg_line.append(@intCast(u8, 64 + 128)); | |
| 763 | diff -= 64; | |
| 764 | } | |
| 765 | } | |
| 757 | 766 | if (dbg_out.pcop_change_index.*) |pci| |
| 758 | 767 | dbg_out.dbg_line.items[pci] += 1; |
| 759 | 768 | dbg_out.pcop_change_index.* = @intCast(u32, dbg_out.dbg_line.items.len - 1); |
src/link.zig+1-1| ... | ... | @@ -643,7 +643,7 @@ pub const File = struct { |
| 643 | 643 | .coff => return @fieldParentPtr(Coff, "base", base).getDeclVAddr(decl), |
| 644 | 644 | .elf => return @fieldParentPtr(Elf, "base", base).getDeclVAddr(decl), |
| 645 | 645 | .macho => return @fieldParentPtr(MachO, "base", base).getDeclVAddr(decl), |
| 646 | .plan9 => @panic("GET VADDR"), | |
| 646 | .plan9 => return @fieldParentPtr(Plan9, "base", base).getDeclVAddr(decl), | |
| 647 | 647 | .c => unreachable, |
| 648 | 648 | .wasm => unreachable, |
| 649 | 649 | .spirv => unreachable, |
src/link/Plan9.zig+24-1| ... | ... | @@ -203,7 +203,7 @@ fn putFn(self: *Plan9, decl: *Module.Decl, out: FnDeclOutput) !void { |
| 203 | 203 | self.syms.items[fn_map_res.value_ptr.sym_index] = .{ |
| 204 | 204 | .type = .z, |
| 205 | 205 | // just put a giant number, no source file will have this many newlines |
| 206 | .value = std.math.maxInt(u32), | |
| 206 | .value = std.math.maxInt(u31), | |
| 207 | 207 | .name = &.{ 0, 0 }, |
| 208 | 208 | }; |
| 209 | 209 | } |
| ... | ... | @@ -740,3 +740,26 @@ pub fn allocateDeclIndexes(self: *Plan9, decl: *Module.Decl) !void { |
| 740 | 740 | _ = self; |
| 741 | 741 | _ = decl; |
| 742 | 742 | } |
| 743 | pub fn getDeclVAddr(self: *Plan9, decl: *const Module.Decl) u64 { | |
| 744 | if (decl.ty.zigTypeTag() == .Fn) { | |
| 745 | var start = self.bases.text; | |
| 746 | var it_file = self.fn_decl_table.iterator(); | |
| 747 | while (it_file.next()) |fentry| { | |
| 748 | var symidx_and_submap = fentry.value_ptr; | |
| 749 | var submap_it = symidx_and_submap.functions.iterator(); | |
| 750 | while (submap_it.next()) |entry| { | |
| 751 | if (entry.key_ptr.* == decl) return start; | |
| 752 | start += entry.value_ptr.code.len; | |
| 753 | } | |
| 754 | } | |
| 755 | unreachable; | |
| 756 | } else { | |
| 757 | var start = self.bases.data + self.got_len * if (!self.sixtyfour_bit) @as(u32, 4) else 8; | |
| 758 | var it = self.data_decl_table.iterator(); | |
| 759 | while (it.next()) |kv| { | |
| 760 | if (decl == kv.key_ptr.*) return start; | |
| 761 | start += kv.value_ptr.len; | |
| 762 | } | |
| 763 | unreachable; | |
| 764 | } | |
| 765 | } |