authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-03-25 11:06:12+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-03-25 23:22:20+01:00
log69e9fe4ede8ccc3a8792304ec76039fd57ba070a
tree3d04ac4cfe5d83fdbfa002bcfac702148a229897
parente599ed4a5f012992e037545ae035e39ace71c16b

dwarf: actually write zeroed out unresolved relocs into emitted DWARF in initDeclState


1 files changed, 4 insertions(+), 4 deletions(-)

src/link/Dwarf.zig+4-4
......@@ -1133,7 +1133,7 @@ pub fn initDeclState(self: *Dwarf, mod: *Module, decl_index: InternPool.DeclInde
11331133 });
11341134 // This is the "relocatable" vaddr, corresponding to `code_buffer` index `0`.
11351135 assert(dbg_line_vaddr_reloc_index == dbg_line_buffer.items.len);
1136 dbg_line_buffer.items.len += ptr_width_bytes;
1136 dbg_line_buffer.writer().writeByteNTimes(0, ptr_width_bytes) catch unreachable;
11371137
11381138 dbg_line_buffer.appendAssumeCapacity(DW.LNS.advance_line);
11391139 // This is the "relocatable" relative line offset from the previous function's end curly
......@@ -1171,12 +1171,12 @@ pub fn initDeclState(self: *Dwarf, mod: *Module, decl_index: InternPool.DeclInde
11711171 // "relocations" and have to be in this fixed place so that functions can be
11721172 // moved in virtual address space.
11731173 assert(dbg_info_low_pc_reloc_index == dbg_info_buffer.items.len);
1174 dbg_info_buffer.items.len += ptr_width_bytes; // DW.AT.low_pc, DW.FORM.addr
1174 dbg_info_buffer.writer().writeByteNTimes(0, ptr_width_bytes) catch unreachable; // DW.AT.low_pc, DW.FORM.addr
11751175 assert(self.getRelocDbgInfoSubprogramHighPC() == dbg_info_buffer.items.len);
1176 dbg_info_buffer.items.len += 4; // DW.AT.high_pc, DW.FORM.data4
1176 dbg_info_buffer.writer().writeByteNTimes(0, 4) catch unreachable; // DW.AT.high_pc, DW.FORM.data4
11771177 if (fn_ret_has_bits) {
11781178 try decl_state.addTypeRelocGlobal(di_atom_index, fn_ret_type, @intCast(dbg_info_buffer.items.len));
1179 dbg_info_buffer.items.len += 4; // DW.AT.type, DW.FORM.ref4
1179 dbg_info_buffer.writer().writeByteNTimes(0, 4) catch unreachable; // DW.AT.type, DW.FORM.ref4
11801180 }
11811181 dbg_info_buffer.appendSliceAssumeCapacity(
11821182 decl_name_slice[0 .. decl_name_slice.len + 1],