authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-04 11:26:01-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-07 16:11:00-04:00
log72c64dd1976f7ea87f56ba640181d4f45dda2090
treec7dbd98084d47f0dd85da22018210ba31c0d88e5
parent5e36170b5ff1cb7710aa9b1c5540b7d11aa62537

Dwarf2: fix verification errors


6 files changed, 206 insertions(+), 203 deletions(-)

src/Zcu.zig+5-5
......@@ -2754,7 +2754,7 @@ pub const LazySrcLoc = struct {
27542754 if (zir_inst == .main_struct_inst) return .{ file, .root };
27552755
27562756 // Otherwise, make sure ZIR is loaded.
2757 const zir = file.zir.?;
2757 const zir = &file.zir.?;
27582758
27592759 const inst = zir.instructions.get(@backingInt(zir_inst));
27602760 const base_node: Ast.Node.Index = switch (inst.tag) {
......@@ -3045,7 +3045,7 @@ pub fn saveZirCache(
30453045 gpa: Allocator,
30463046 cache_file_writer: *Io.File.Writer,
30473047 stat: Io.File.Stat,
3048 zir: Zir,
3048 zir: *const Zir,
30493049) (Io.File.Writer.Error || Allocator.Error)!void {
30503050 const safety_buffer = if (data_has_safety_tag)
30513051 try gpa.alloc([8]u8, zir.instructions.len)
......@@ -3085,7 +3085,7 @@ pub fn saveZirCache(
30853085 };
30863086}
30873087
3088pub fn saveZoirCache(cache_file_writer: *Io.File.Writer, stat: Io.File.Stat, zoir: Zoir) Io.File.Writer.Error!void {
3088pub fn saveZoirCache(cache_file_writer: *Io.File.Writer, stat: Io.File.Stat, zoir: *const Zoir) Io.File.Writer.Error!void {
30893089 const header: Zoir.Header = .{
30903090 .nodes_len = @intCast(zoir.nodes.len),
30913091 .extra_len = @intCast(zoir.extra.len),
......@@ -3399,8 +3399,8 @@ pub fn flushRetryableFailures(zcu: *Zcu) !void {
33993399
34003400pub fn mapOldZirToNew(
34013401 gpa: Allocator,
3402 old_zir: Zir,
3403 new_zir: Zir,
3402 old_zir: *const Zir,
3403 new_zir: *const Zir,
34043404 inst_map: *std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index),
34053405) Allocator.Error!void {
34063406 // Contain ZIR indexes of namespace declaration instructions, e.g. struct_decl, union_decl, etc.
src/Zcu/PerThread.zig+23-20
......@@ -389,17 +389,18 @@ fn workerUpdateFile(
389389 // Discover all imports in the file. Imports of modules we ignore for now since we don't
390390 // know which module we're in, but imports of file paths might need us to queue up other
391391 // AstGen jobs.
392 const imports_index = file.zir.?.extra[@backingInt(Zir.ExtraIndex.imports)];
392 const zir = &file.zir.?;
393 const imports_index = zir.extra[@backingInt(Zir.ExtraIndex.imports)];
393394 if (imports_index != 0) {
394 const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_index);
395 const extra = zir.extraData(Zir.Inst.Imports, imports_index);
395396 var import_i: u32 = 0;
396397 var extra_index = extra.end;
397398
398399 while (import_i < extra.data.imports_len) : (import_i += 1) {
399 const item = file.zir.?.extraData(Zir.Inst.Imports.Item, extra_index);
400 const item = zir.extraData(Zir.Inst.Imports.Item, extra_index);
400401 extra_index = item.end;
401402
402 const import_path = file.zir.?.nullTerminatedString(item.data.name);
403 const import_path = zir.nullTerminatedString(item.data.name);
403404
404405 if (active.pt.discoverImport(file.path, import_path)) |res| switch (res) {
405406 .module, .existing_file => {},
......@@ -652,7 +653,7 @@ pub fn updateFile(
652653 switch (file.getMode()) {
653654 .zig => {
654655 file.zir = try AstGen.generate(gpa, file.tree.?);
655 Zcu.saveZirCache(gpa, &cache_file_writer, stat, file.zir.?) catch |err| switch (err) {
656 Zcu.saveZirCache(gpa, &cache_file_writer, stat, &file.zir.?) catch |err| switch (err) {
656657 error.OutOfMemory => |e| return e,
657658 else => log.warn("unable to write cached ZIR code for {f} to {f}{s}: {t}", .{
658659 file.path.fmt(comp), cache_directory, &hex_digest, err,
......@@ -661,7 +662,7 @@ pub fn updateFile(
661662 },
662663 .zon => {
663664 file.zoir = try ZonGen.generate(gpa, file.tree.?, .{});
664 Zcu.saveZoirCache(&cache_file_writer, stat, file.zoir.?) catch |err| {
665 Zcu.saveZoirCache(&cache_file_writer, stat, &file.zoir.?) catch |err| {
665666 log.warn("unable to write cached ZOIR code for {f} to {f}{s}: {t}", .{
666667 file.path.fmt(comp), cache_directory, &hex_digest, err,
667668 });
......@@ -694,12 +695,13 @@ pub fn updateFile(
694695
695696 switch (file.getMode()) {
696697 .zig => {
697 if (file.zir.?.hasCompileErrors()) {
698 const zir = &file.zir.?;
699 if (zir.hasCompileErrors()) {
698700 comp.mutex.lockUncancelable(io);
699701 defer comp.mutex.unlock(io);
700702 try zcu.failed_files.putNoClobber(gpa, file_index, null);
701703 }
702 if (file.zir.?.loweringFailed()) {
704 if (zir.loweringFailed()) {
703705 file.status = .astgen_failure;
704706 } else {
705707 file.status = .success;
......@@ -829,14 +831,14 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void {
829831 },
830832 }
831833 const old_zir = file.prev_zir orelse continue;
832 const new_zir = file.zir.?;
834 const new_zir = &file.zir.?;
833835 const gop = try updated_files.getOrPut(gpa, file_index);
834836 assert(!gop.found_existing);
835837 gop.value_ptr.* = .{
836838 .file = file,
837839 .inst_map = .{},
838840 };
839 try Zcu.mapOldZirToNew(gpa, old_zir.*, new_zir, &gop.value_ptr.inst_map);
841 try Zcu.mapOldZirToNew(gpa, old_zir, new_zir, &gop.value_ptr.inst_map);
840842 }
841843
842844 if (updated_files.count() == 0)
......@@ -870,7 +872,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void {
870872 const old_tag = old_zir.instructions.items(.tag)[@backingInt(old_inst)];
871873 const old_data = old_zir.instructions.items(.data)[@backingInt(old_inst)];
872874
873 const new_zir = file.zir.?;
875 const new_zir = &file.zir.?;
874876 const new_data = new_zir.instructions.items(.data)[@backingInt(new_inst)];
875877
876878 debug_update_line_number: {
......@@ -2640,7 +2642,7 @@ fn computeAliveFiles(pt: Zcu.PerThread) Allocator.Error!bool {
26402642
26412643 if (file.status != .success) continue; // ZIR not valid if there was a file failure
26422644
2643 const zir = file.zir.?;
2645 const zir = &file.zir.?;
26442646 const imports_index = zir.extra[@backingInt(Zir.ExtraIndex.imports)];
26452647 if (imports_index == 0) continue; // this Zig file has no imports
26462648 const extra = zir.extraData(Zir.Inst.Imports, imports_index);
......@@ -2809,15 +2811,16 @@ pub fn updateBuiltinModule(pt: Zcu.PerThread, opts: Builtin) Allocator.Error!voi
28092811 try opts.populateFile(gpa, file);
28102812
28112813 assert(file.status == .success);
2812 assert(!file.zir.?.hasCompileErrors());
2814 const zir = &file.zir.?;
2815 assert(!zir.hasCompileErrors());
28132816 {
28142817 // Check that it has only one import, which is 'std'.
2815 const imports_idx = file.zir.?.extra[@backingInt(Zir.ExtraIndex.imports)];
2818 const imports_idx = zir.extra[@backingInt(Zir.ExtraIndex.imports)];
28162819 assert(imports_idx != 0); // there is an import
2817 const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_idx);
2820 const extra = zir.extraData(Zir.Inst.Imports, imports_idx);
28182821 assert(extra.data.imports_len == 1); // there is exactly one import
2819 const item = file.zir.?.extraData(Zir.Inst.Imports.Item, extra.end);
2820 const import_path = file.zir.?.nullTerminatedString(item.data.name);
2822 const item = zir.extraData(Zir.Inst.Imports.Item, extra.end);
2823 const import_path = zir.nullTerminatedString(item.data.name);
28212824 assert(mem.eql(u8, import_path, "std")); // the single import is of 'std'
28222825 }
28232826
......@@ -3137,7 +3140,7 @@ const ScanDeclIter = struct {
31373140 const gpa = comp.gpa;
31383141 const io = comp.io;
31393142 const file = namespace.fileScope(zcu);
3140 const zir = file.zir.?;
3143 const zir = &file.zir.?;
31413144 const ip = &zcu.intern_pool;
31423145
31433146 const decl = zir.getDeclaration(decl_inst);
......@@ -3572,11 +3575,11 @@ fn lockAndClearFileCompileError(pt: Zcu.PerThread, file_index: Zcu.File.Index, f
35723575 .astgen_failure => true,
35733576 .success => switch (file.getMode()) {
35743577 .zig => has_error: {
3575 const zir = file.zir orelse break :has_error false;
3578 const zir = &(file.zir orelse break :has_error false);
35763579 break :has_error zir.hasCompileErrors();
35773580 },
35783581 .zon => has_error: {
3579 const zoir = file.zoir orelse break :has_error false;
3582 const zoir = &(file.zoir orelse break :has_error false);
35803583 break :has_error zoir.hasCompileErrors();
35813584 },
35823585 },
src/link/Dwarf2.zig+175-175
......@@ -637,7 +637,7 @@ pub const WipNav = struct {
637637 pub const Debug = struct {
638638 wip_nav: WipNav,
639639 pt: Zcu.PerThread,
640 any_children: bool,
640 empty: bool,
641641 blocks: std.ArrayList(struct {
642642 abbrev_code: u32,
643643 low_pc_off: usize,
......@@ -763,14 +763,19 @@ pub const WipNav = struct {
763763 }
764764 fn finishDebugInfo(debug: *Debug, func_length: u64) link.EmitError!void {
765765 const dwarf = debug.wip_nav.dwarf;
766 const di_w = &debug.info_writer.interface;
766 const di_nw = &debug.info_writer;
767 const di_w = &di_nw.interface;
767768 std.mem.writeInt(
768769 u32,
769770 di_w.buffered()[debug.info_func_length_offset..][0..4],
770771 @intCast(func_length),
771772 dwarf.endian,
772773 );
773 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
774 if (debug.empty) std.leb.writeUnsignedFixed(
775 AbbrevCode.decl_size,
776 di_w.buffered()[0..AbbrevCode.decl_size],
777 @intCast(try dwarf.refAbbrevCode(di_nw.mf, .decl_empty_func)),
778 ) else try di_w.writeUleb128(@backingInt(AbbrevCode.null));
774779 try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen());
775780 }
776781 fn finishDebugLine(debug: *Debug) link.EmitError!void {
......@@ -808,7 +813,7 @@ pub const WipNav = struct {
808813 if (opt_name) |name| try dwarf.strp(&dwarf.debug_str, di_nw, name);
809814 try dwarf.refType(debug.pt, di_nw, ty);
810815 try dwarf.exprLoc(di_nw, loc);
811 debug.any_children = true;
816 debug.empty = false;
812817 }
813818
814819 pub const LocalConstTag = enum { comptime_arg, local_const };
......@@ -862,7 +867,7 @@ pub const WipNav = struct {
862867 try dwarf.refType(pt, di_nw, ty);
863868 if (ty_class.hasRuntimeBits()) try dwarf.blockConst(pt, di_nw, val);
864869 if (ty_class.comptimeOnly()) try dwarf.refConst(pt, di_nw, val);
865 debug.any_children = true;
870 debug.empty = false;
866871 }
867872
868873 pub fn genVarArgsDebugInfo(debug: *Debug) link.Error!void {
......@@ -874,7 +879,7 @@ pub const WipNav = struct {
874879 fn genVarArgsDebugInfoInner(debug: *Debug) link.EmitError!void {
875880 assert(debug.wip_nav.func != .none);
876881 try debug.wip_nav.dwarf.abbrevCode(&debug.info_writer, .is_var_args);
877 debug.any_children = true;
882 debug.empty = false;
878883 }
879884
880885 pub fn advanceLineAndPc(
......@@ -993,7 +998,7 @@ pub const WipNav = struct {
993998 try dwarf.addrSym(di_nw, debug.wip_nav.func_si, code_off);
994999 block.high_pc = @intCast(di_w.end);
9951000 try di_w.writeInt(u32, 0, dwarf.endian);
996 debug.any_children = false;
1001 debug.empty = true;
9971002 }
9981003
9991004 pub fn leaveBlock(debug: *Debug, code_off: usize) link.Error!void {
......@@ -1004,26 +1009,23 @@ pub const WipNav = struct {
10041009 }
10051010 fn leaveBlockInner(debug: *Debug, code_off: usize) link.EmitError!void {
10061011 const dwarf = debug.wip_nav.dwarf;
1007 const block_size = comptime uleb128Size(@backingInt(AbbrevCode.block));
10081012 const block = debug.blocks.pop().?;
10091013
10101014 const di_nw = &debug.info_writer;
10111015 const di_w = &di_nw.interface;
1012 if (debug.any_children)
1013 try di_w.writeUleb128(@backingInt(AbbrevCode.null))
1014 else
1015 std.leb.writeUnsignedFixed(
1016 block_size,
1017 di_w.buffered()[block.abbrev_code..][0..block_size],
1018 @intCast(try dwarf.refAbbrevCode(di_nw.mf, .empty_block)),
1019 );
1016 const block_size = comptime uleb128Size(@backingInt(AbbrevCode.block));
1017 if (debug.empty) std.leb.writeUnsignedFixed(
1018 block_size,
1019 di_w.buffered()[block.abbrev_code..][0..block_size],
1020 @intCast(try dwarf.refAbbrevCode(di_nw.mf, .empty_block)),
1021 ) else try di_w.writeUleb128(@backingInt(AbbrevCode.null));
10201022 std.mem.writeInt(
10211023 u32,
10221024 di_nw.interface.buffered()[block.high_pc..][0..4],
10231025 @intCast(code_off - block.low_pc_off),
10241026 dwarf.endian,
10251027 );
1026 debug.any_children = true;
1028 debug.empty = false;
10271029 }
10281030
10291031 pub fn enterInlineFunc(
......@@ -1064,7 +1066,7 @@ pub const WipNav = struct {
10641066 block.high_pc = @intCast(di_w.end);
10651067 try di_w.writeInt(u32, 0, dwarf.endian);
10661068 try debug.setInlineFunc(func);
1067 debug.any_children = false;
1069 debug.empty = true;
10681070 }
10691071
10701072 pub fn leaveInlineFunc(debug: *Debug, func: InternPool.Index, code_off: usize) link.Error!void {
......@@ -1079,19 +1081,16 @@ pub const WipNav = struct {
10791081 code_off: usize,
10801082 ) link.EmitError!void {
10811083 const dwarf = debug.wip_nav.dwarf;
1082 const inlined_func_size = comptime uleb128Size(@backingInt(AbbrevCode.inlined_func));
10831084 const block = debug.blocks.pop().?;
10841085
10851086 const di_nw = &debug.info_writer;
10861087 const di_w = &di_nw.interface;
1087 if (debug.any_children)
1088 try di_w.writeUleb128(@backingInt(AbbrevCode.null))
1089 else
1090 std.leb.writeUnsignedFixed(
1091 inlined_func_size,
1092 di_w.buffered()[block.abbrev_code..][0..inlined_func_size],
1093 @intCast(try dwarf.refAbbrevCode(di_nw.mf, .empty_inlined_func)),
1094 );
1088 const inlined_func_size = comptime uleb128Size(@backingInt(AbbrevCode.inlined_func));
1089 if (debug.empty) std.leb.writeUnsignedFixed(
1090 inlined_func_size,
1091 di_w.buffered()[block.abbrev_code..][0..inlined_func_size],
1092 @intCast(try dwarf.refAbbrevCode(di_nw.mf, .empty_inlined_func)),
1093 ) else try di_w.writeUleb128(@backingInt(AbbrevCode.null));
10951094 std.mem.writeInt(
10961095 u32,
10971096 di_w.buffered()[block.high_pc..][0..4],
......@@ -1099,7 +1098,7 @@ pub const WipNav = struct {
10991098 dwarf.endian,
11001099 );
11011100 try debug.setInlineFunc(func);
1102 debug.any_children = true;
1101 debug.empty = false;
11031102 }
11041103
11051104 pub fn setInlineFunc(debug: *Debug, func: InternPool.Index) link.Error!void {
......@@ -1398,25 +1397,26 @@ pub fn getGlobal(dwarf: *Dwarf, nav: InternPool.Nav.Index) link.Error!Global.Ind
13981397 if (global_gop.value_ptr.debug_info_ni != .none) return gi;
13991398 const mod = comp.zcu.?.navFileScope(nav).mod.?;
14001399 assert(!mod.strip);
1401 const elf = dwarf.lf.cast(.elf2).?;
1402 try elf.nodes.ensureUnusedCapacity(gpa, 1);
1403 try elf.dwarf_globals.append(gpa, .{
1404 .debug_info_first_target_reloc = .none,
1405 .debug_info_first_node_reloc = .none,
1406 .debug_info_first_symbol_reloc = .none,
1407 });
1408 const unit = dwarf.getUnit(mod).get(dwarf);
1409 global_gop.value_ptr.debug_info_ni = .wrap(elf.addNodeAssumeCapacity(
1410 unit.debug_info_ni.unwrap().?.addFloatingChild(gpa, &elf.mf, .{
1411 .enable_next_moved = true,
1412 }) catch |err| switch (err) {
1413 else => |e| return e,
1414 error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{
1415 elf.mf.io_err.?,
1416 }),
1417 },
1418 .{ .global_debug_info = gi },
1419 ));
1400 if (dwarf.lf.cast(.elf2)) |elf| {
1401 try elf.nodes.ensureUnusedCapacity(gpa, 1);
1402 try elf.dwarf_globals.append(gpa, .{
1403 .debug_info_first_target_reloc = .none,
1404 .debug_info_first_node_reloc = .none,
1405 .debug_info_first_symbol_reloc = .none,
1406 });
1407 const unit = dwarf.getUnit(mod).get(dwarf);
1408 global_gop.value_ptr.debug_info_ni = .wrap(elf.addNodeAssumeCapacity(
1409 unit.debug_info_ni.unwrap().?.addFloatingChild(gpa, &elf.mf, .{
1410 .enable_next_moved = true,
1411 }) catch |err| switch (err) {
1412 else => |e| return e,
1413 error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{
1414 elf.mf.io_err.?,
1415 }),
1416 },
1417 .{ .global_debug_info = gi },
1418 ));
1419 } else unreachable;
14201420 return gi;
14211421}
14221422pub fn getGlobalIfExists(dwarf: *Dwarf, nav: InternPool.Nav.Index) ?Global.Index {
......@@ -1436,30 +1436,31 @@ pub fn getFunc(dwarf: *Dwarf, nav: InternPool.Nav.Index) link.Error!Func.Index {
14361436 const fi: Func.Index = @fromBackingInt(@intCast(func_gop.index));
14371437 if (func_gop.value_ptr.debug_info_ni != .none) return fi;
14381438 const mod = comp.zcu.?.navFileScope(nav).mod.?;
1439 const elf = dwarf.lf.cast(.elf2).?;
1440 try elf.nodes.ensureUnusedCapacity(gpa, 1);
1441 try elf.dwarf_funcs.append(gpa, .{
1442 .frame_fde_first_symbol_reloc = .none,
1443 .frame_fde_first_node_reloc = .none,
1444 .debug_info_first_target_reloc = .none,
1445 .debug_info_first_symbol_reloc = .none,
1446 .debug_info_first_node_reloc = .none,
1447 .debug_line_first_symbol_reloc = .none,
1448 .debug_line_first_node_reloc = .none,
1449 });
1450 if (mod.strip) return fi;
1451 const unit = dwarf.getUnit(mod).get(dwarf);
1452 func_gop.value_ptr.debug_info_ni = .wrap(elf.addNodeAssumeCapacity(
1453 unit.debug_info_ni.unwrap().?.addFloatingChild(gpa, &elf.mf, .{
1454 .enable_next_moved = true,
1455 }) catch |err| switch (err) {
1456 else => |e| return e,
1457 error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{
1458 elf.mf.io_err.?,
1459 }),
1460 },
1461 .{ .func_debug_info = fi },
1462 ));
1439 if (dwarf.lf.cast(.elf2)) |elf| {
1440 try elf.nodes.ensureUnusedCapacity(gpa, 1);
1441 try elf.dwarf_funcs.append(gpa, .{
1442 .frame_fde_first_symbol_reloc = .none,
1443 .frame_fde_first_node_reloc = .none,
1444 .debug_info_first_target_reloc = .none,
1445 .debug_info_first_symbol_reloc = .none,
1446 .debug_info_first_node_reloc = .none,
1447 .debug_line_first_symbol_reloc = .none,
1448 .debug_line_first_node_reloc = .none,
1449 });
1450 if (mod.strip) return fi;
1451 const unit = dwarf.getUnit(mod).get(dwarf);
1452 func_gop.value_ptr.debug_info_ni = .wrap(elf.addNodeAssumeCapacity(
1453 unit.debug_info_ni.unwrap().?.addFloatingChild(gpa, &elf.mf, .{
1454 .enable_next_moved = true,
1455 }) catch |err| switch (err) {
1456 else => |e| return e,
1457 error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{
1458 elf.mf.io_err.?,
1459 }),
1460 },
1461 .{ .func_debug_info = fi },
1462 ));
1463 } else unreachable;
14631464 return fi;
14641465}
14651466pub fn getFuncIfExists(dwarf: *Dwarf, nav: InternPool.Nav.Index) ?Func.Index {
......@@ -1530,24 +1531,26 @@ pub fn getDecl(
15301531 const di: Decl.Index = @fromBackingInt(@intCast(decl_gop.index));
15311532 if (decl_gop.value_ptr.debug_info_ni.unwrap()) |debug_info_ni| return debug_info_ni;
15321533 dwarf.pending_decl = .{ .di = di, .instance_val = instance_val };
1533 const elf = dwarf.lf.cast(.elf2).?;
1534 try elf.nodes.ensureUnusedCapacity(gpa, 1);
1535 try elf.dwarf_decls.putNoClobber(gpa, di, .{
1536 .debug_info_first_target_reloc = .none,
1537 .debug_info_first_node_reloc = .none,
1538 });
1539 const unit = dwarf.getUnit(zcu.fileByIndex(di.srcInst(dwarf).resolveFile(ip)).mod.?).get(dwarf);
1540 const debug_info_ni = elf.addNodeAssumeCapacity(
1541 unit.debug_info_ni.unwrap().?.addFloatingChild(gpa, &elf.mf, .{
1542 .enable_next_moved = true,
1543 }) catch |err| switch (err) {
1544 else => |e| return e,
1545 error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{
1546 elf.mf.io_err.?,
1547 }),
1548 },
1549 .{ .decl_debug_info = di },
1550 );
1534 const debug_info_ni = if (dwarf.lf.cast(.elf2)) |elf| debug_info_ni: {
1535 try elf.nodes.ensureUnusedCapacity(gpa, 1);
1536 try elf.dwarf_decls.putNoClobber(gpa, di, .{
1537 .debug_info_first_target_reloc = .none,
1538 .debug_info_first_node_reloc = .none,
1539 });
1540 const unit = dwarf.getUnit(zcu.fileByIndex(di.srcInst(dwarf).resolveFile(ip)).mod.?).get(dwarf);
1541 const debug_info_ni = elf.addNodeAssumeCapacity(
1542 unit.debug_info_ni.unwrap().?.addFloatingChild(gpa, &elf.mf, .{
1543 .enable_next_moved = true,
1544 }) catch |err| switch (err) {
1545 else => |e| return e,
1546 error.MappedFileIo => return comp.link_diags.fail("failed to write output file: {t}", .{
1547 elf.mf.io_err.?,
1548 }),
1549 },
1550 .{ .decl_debug_info = di },
1551 );
1552 break :debug_info_ni debug_info_ni;
1553 } else unreachable;
15511554 decl_gop.value_ptr.debug_info_ni = .wrap(debug_info_ni);
15521555 return debug_info_ni;
15531556}
......@@ -2428,13 +2431,12 @@ fn updateConstInner(
24282431 },
24292432 .struct_type => {
24302433 const loaded_struct = ip.loadStructType(val);
2431 const zfi = loaded_struct.zir_index.resolveFile(ip);
2432 const zf = zcu.fileByIndex(zfi);
2433 const src_inst = loaded_struct.zir_index.resolve(ip);
2434 if (src_inst == .main_struct_inst) {
2434 const src_inst = loaded_struct.zir_index.resolveFull(ip).?;
2435 const zf = zcu.fileByIndex(src_inst.file);
2436 if (src_inst.inst == .main_struct_inst) {
24352437 assert(loaded_struct.captures.len == 0);
24362438 const ui = dwarf.getUnit(zf.mod.?);
2437 _, const fi = try ui.get(dwarf).getFile(zcu.gpa, ui, zfi);
2439 _, const fi = try ui.get(dwarf).getFile(zcu.gpa, ui, src_inst.file);
24382440 try dwarf.abbrevCode(di_nw, switch (loaded_struct.layout) {
24392441 .auto => if (loaded_struct.field_types.len > 0) .file else .empty_file,
24402442 .@"extern", .@"packed" => unreachable,
......@@ -2472,7 +2474,7 @@ fn updateConstInner(
24722474 try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private);
24732475 try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip));
24742476 } else {
2475 const decl = zf.zir.?.getStructDecl(src_inst.?);
2477 const decl = zf.zir.?.getStructDecl(src_inst.inst);
24762478 const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr(
24772479 ip.namespacePtr(loaded_struct.namespace).parent.unwrap().?,
24782480 ).owner_type);
......@@ -2709,6 +2711,7 @@ fn updateConstInner(
27092711 .none => {
27102712 const zfi = loaded_enum.zir_index.unwrap().?.resolveFile(ip);
27112713 const zf = zcu.fileByIndex(zfi);
2714 const zir = &zf.zir.?;
27122715 if (loaded_enum.captures.len > 0 or loaded_enum.is_reified) {
27132716 try dwarf.abbrevCode(di_nw, if (loaded_enum.captures.len > 0 or
27142717 loaded_enum.field_names.len > 0)
......@@ -2718,7 +2721,7 @@ fn updateConstInner(
27182721 try dwarf.secOffset(di_nw, try dwarf.getDecl(pt, val), 0);
27192722 } else if (loaded_enum.name_nav.unwrap()) |name_ni| {
27202723 const name_nav = ip.getNav(name_ni);
2721 const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?);
2724 const decl = zir.getDeclaration(name_nav.srcInst(ip).resolve(ip).?);
27222725 const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr(
27232726 name_nav.analysis.?.namespace,
27242727 ).owner_type);
......@@ -2732,8 +2735,7 @@ fn updateConstInner(
27322735 try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private);
27332736 try dwarf.strp(&dwarf.debug_str, di_nw, name_nav.name.toSlice(ip));
27342737 } else {
2735 const decl =
2736 zf.zir.?.getEnumDecl(loaded_enum.zir_index.unwrap().?.resolve(ip).?);
2738 const decl = zir.getEnumDecl(loaded_enum.zir_index.unwrap().?.resolve(ip).?);
27372739 const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr(
27382740 ip.namespacePtr(loaded_enum.namespace).parent.unwrap().?,
27392741 ).owner_type);
......@@ -2756,6 +2758,7 @@ fn updateConstInner(
27562758 },
27572759 }
27582760 try dwarf.refType(pt, di_nw, .fromInterned(loaded_enum.int_tag_type));
2761 try dwarf.genCaptures(pt, di_nw, loaded_enum.captures);
27592762 for (0..loaded_enum.field_names.len) |field_index| {
27602763 try dwarf.abbrevCode(di_nw, .enum_field);
27612764 try dwarf.enumConstValue(di_w, loaded_enum, field_index);
......@@ -2772,10 +2775,10 @@ fn updateConstInner(
27722775 .opaque_type => return dwarf.updateConstIncompleteInner(pt, di_nw, val),
27732776 .spirv_type => unreachable,
27742777 .func_type => |func_type| {
2775 const is_nullary = func_type.param_types.len == 0 and !func_type.is_var_args;
2778 const is_empty = func_type.param_types.len == 0 and !func_type.is_var_args;
27762779 const name = try zcu.gpa.print("{f}", .{Type.fromInterned(val).fmt(pt)});
27772780 defer zcu.gpa.free(name);
2778 try dwarf.abbrevCode(di_nw, if (is_nullary) .nullary_func_type else .func_type);
2781 try dwarf.abbrevCode(di_nw, if (is_empty) .empty_func_type else .func_type);
27792782 try dwarf.strp(&dwarf.debug_str, di_nw, name);
27802783 const cc: DW.CC = cc: {
27812784 if (zcu.getTarget().cCallingConvention()) |cc| {
......@@ -2848,16 +2851,14 @@ fn updateConstInner(
28482851 };
28492852 try di_w.writeByte(@backingInt(cc));
28502853 try dwarf.refType(pt, di_nw, .fromInterned(func_type.return_type));
2851 if (!is_nullary) {
2852 for (0..func_type.param_types.len) |param_index| {
2853 try dwarf.abbrevCode(di_nw, .unnamed_param);
2854 try dwarf.refType(pt, di_nw, .fromInterned(
2855 func_type.param_types.get(ip)[param_index],
2856 ));
2857 }
2858 if (func_type.is_var_args) try dwarf.abbrevCode(di_nw, .is_var_args);
2859 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
2854 for (0..func_type.param_types.len) |param_index| {
2855 try dwarf.abbrevCode(di_nw, .unnamed_param);
2856 try dwarf.refType(pt, di_nw, .fromInterned(
2857 func_type.param_types.get(ip)[param_index],
2858 ));
28602859 }
2860 if (func_type.is_var_args) try dwarf.abbrevCode(di_nw, .is_var_args);
2861 if (!is_empty) try di_w.writeUleb128(@backingInt(AbbrevCode.null));
28612862 },
28622863 .error_set_type => |error_set_type| {
28632864 const name = try zcu.gpa.print("{f}", .{Type.fromInterned(val).fmt(pt)});
......@@ -2897,37 +2898,36 @@ fn updateConstInner(
28972898
28982899 else => return,
28992900 .func => |func| {
2900 const fn_ty = ip.indexToKey(func.ty).func_type;
2901 const func_type = ip.indexToKey(func.ty).func_type;
29012902 const nav = ip.getNav(func.owner_nav);
29022903 const inst_info = nav.srcInst(ip).resolveFull(ip).?;
29032904 const zf = zcu.fileByIndex(inst_info.file);
2904 const decl = zf.zir.?.getDeclaration(inst_info.inst);
2905 const zir = &zf.zir.?;
2906 const decl = zir.getDeclaration(inst_info.inst);
2907 const empty = func_type.param_types.len == 0 and !func_type.is_var_args;
29052908 const parent_ty: Type = .fromInterned(ip.namespacePtr(nav.analysis.?.namespace).owner_type);
2906 try dwarf.abbrevCode(di_nw, .decl_func_generic);
2909 try dwarf.abbrevCode(di_nw, if (empty) .decl_empty_func_generic else .decl_func_generic);
29072910 try dwarf.refType(pt, di_nw, parent_ty);
29082911 try di_w.writeInt(u32, decl.src_line + 1, dwarf.endian);
29092912 try di_w.writeUleb128(decl.src_column + 1);
29102913 try di_w.writeByte(if (decl.is_pub) DW.ACCESS.public else DW.ACCESS.private);
29112914 try dwarf.strp(&dwarf.debug_str, di_nw, nav.name.toSlice(ip));
2912 try dwarf.refType(pt, di_nw, .fromInterned(fn_ty.return_type));
2913 var param_index: u32 = 0;
2914 for (zf.zir.?.getParamBody(func.zir_body_inst.resolve(ip).?)) |param_inst| {
2915 switch (zf.zir.?.getParamName(param_inst) orelse break) {
2915 try dwarf.refType(pt, di_nw, .fromInterned(func_type.return_type));
2916 for (
2917 zir.getParamBody(func.zir_body_inst.resolve(ip).?)[0..func_type.param_types.len],
2918 func_type.param_types.get(&zcu.intern_pool),
2919 ) |param_inst, param_ty| {
2920 switch (zir.getParamName(param_inst).?) {
29162921 .empty => try dwarf.abbrevCode(di_nw, .unnamed_param),
29172922 else => |param_name| {
29182923 try dwarf.abbrevCode(di_nw, .param);
2919 try dwarf.strp(&dwarf.debug_str, di_nw, zf.zir.?.nullTerminatedString(
2920 param_name,
2921 ));
2924 try dwarf.strp(&dwarf.debug_str, di_nw, zir.nullTerminatedString(param_name));
29222925 },
29232926 }
2924 try dwarf.refType(pt, di_nw, .fromInterned(
2925 fn_ty.param_types.get(&zcu.intern_pool)[param_index],
2926 ));
2927 param_index += 1;
2927 try dwarf.refType(pt, di_nw, .fromInterned(param_ty));
29282928 }
2929 if (fn_ty.is_var_args) try dwarf.abbrevCode(di_nw, .is_var_args);
2930 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
2929 if (func_type.is_var_args) try dwarf.abbrevCode(di_nw, .is_var_args);
2930 if (!empty) try di_w.writeUleb128(@backingInt(AbbrevCode.null));
29312931 },
29322932
29332933 .memoized_call => unreachable, // not a value
......@@ -2988,16 +2988,16 @@ fn updateConstIncompleteInner(
29882988 break :done;
29892989 },
29902990 else => {
2991 const data =
2992 zf.zir.?.instructions.items(.data)[@backingInt(src_inst.inst)].extended;
2991 const zir = &zf.zir.?;
2992 const data = zir.instructions.items(.data)[@backingInt(src_inst.inst)].extended;
29932993 const src_line, const src_column = src_loc: switch (data.opcode) {
29942994 else => unreachable,
29952995 .struct_decl => {
2996 const decl = zf.zir.?.getStructDecl(src_inst.inst);
2996 const decl = zir.getStructDecl(src_inst.inst);
29972997 break :src_loc .{ decl.src_line, decl.src_column };
29982998 },
29992999 .reify_struct => {
3000 const decl = zf.zir.?.extraData(
3000 const decl = zir.extraData(
30013001 std.zig.Zir.Inst.ReifyStruct,
30023002 data.operand,
30033003 ).data;
......@@ -3025,15 +3025,16 @@ fn updateConstIncompleteInner(
30253025 break :done;
30263026 };
30273027 const zf = zcu.fileByIndex(src_inst.file);
3028 const data = zf.zir.?.instructions.items(.data)[@backingInt(src_inst.inst)].extended;
3028 const zir = &zf.zir.?;
3029 const data = zir.instructions.items(.data)[@backingInt(src_inst.inst)].extended;
30293030 const src_line, const src_column = src_loc: switch (data.opcode) {
30303031 else => unreachable,
30313032 .union_decl => {
3032 const decl = zf.zir.?.getUnionDecl(src_inst.inst);
3033 const decl = zir.getUnionDecl(src_inst.inst);
30333034 break :src_loc .{ decl.src_line, decl.src_column };
30343035 },
30353036 .reify_union => {
3036 const decl = zf.zir.?.extraData(std.zig.Zir.Inst.ReifyUnion, data.operand).data;
3037 const decl = zir.extraData(std.zig.Zir.Inst.ReifyUnion, data.operand).data;
30373038 break :src_loc .{ decl.src_line, decl.src_column };
30383039 },
30393040 };
......@@ -3062,15 +3063,16 @@ fn updateConstIncompleteInner(
30623063 break :done;
30633064 };
30643065 const zf = zcu.fileByIndex(src_inst.file);
3065 const data = zf.zir.?.instructions.items(.data)[@backingInt(src_inst.inst)].extended;
3066 const zir = &zf.zir.?;
3067 const data = zir.instructions.items(.data)[@backingInt(src_inst.inst)].extended;
30663068 const src_line, const src_column = src_loc: switch (data.opcode) {
30673069 else => unreachable,
30683070 .enum_decl => {
3069 const decl = zf.zir.?.getEnumDecl(src_inst.inst);
3071 const decl = zir.getEnumDecl(src_inst.inst);
30703072 break :src_loc .{ decl.src_line, decl.src_column };
30713073 },
30723074 .reify_enum => {
3073 const decl = zf.zir.?.extraData(std.zig.Zir.Inst.ReifyEnum, data.operand).data;
3075 const decl = zir.extraData(std.zig.Zir.Inst.ReifyEnum, data.operand).data;
30743076 break :src_loc .{ decl.src_line, decl.src_column };
30753077 },
30763078 };
......@@ -3251,18 +3253,19 @@ fn genDeclInner(
32513253 break :done;
32523254 };
32533255 const zf = zcu.fileByIndex(src_inst.file);
3254 const inst = zf.zir.?.instructions.get(@backingInt(src_inst.inst));
3256 const zir = &zf.zir.?;
3257 const inst = zir.instructions.get(@backingInt(src_inst.inst));
32553258 const src_line, const src_column, const capture_names = decl: switch (inst.tag) {
32563259 else => unreachable,
32573260 .struct_init, .struct_init_ref => {
3258 const decl = zf.zir.?.extraData(
3261 const decl = zir.extraData(
32593262 std.zig.Zir.Inst.StructInit,
32603263 inst.data.pl_node.payload_index,
32613264 ).data;
32623265 break :decl .{ decl.src_line, decl.src_column, &.{} };
32633266 },
32643267 .struct_init_anon => {
3265 const decl = zf.zir.?.extraData(
3268 const decl = zir.extraData(
32663269 std.zig.Zir.Inst.StructInitAnon,
32673270 inst.data.pl_node.payload_index,
32683271 ).data;
......@@ -3271,11 +3274,11 @@ fn genDeclInner(
32713274 .extended => switch (inst.data.extended.opcode) {
32723275 else => unreachable,
32733276 .struct_decl => {
3274 const decl = zf.zir.?.getStructDecl(src_inst.inst);
3277 const decl = zir.getStructDecl(src_inst.inst);
32753278 break :decl .{ decl.src_line, decl.src_column, decl.capture_names };
32763279 },
32773280 .reify_struct => {
3278 const decl = zf.zir.?.extraData(
3281 const decl = zir.extraData(
32793282 std.zig.Zir.Inst.ReifyStruct,
32803283 inst.data.extended.operand,
32813284 ).data;
......@@ -3302,17 +3305,18 @@ fn genDeclInner(
33023305 break :done;
33033306 };
33043307 const zf = zcu.fileByIndex(src_inst.file);
3305 const inst = zf.zir.?.instructions.get(@backingInt(src_inst.inst));
3308 const zir = &zf.zir.?;
3309 const inst = zir.instructions.get(@backingInt(src_inst.inst));
33063310 const src_line, const src_column, const capture_names = decl: switch (inst.tag) {
33073311 else => unreachable,
33083312 .extended => switch (inst.data.extended.opcode) {
33093313 else => unreachable,
33103314 .union_decl => {
3311 const decl = zf.zir.?.getUnionDecl(src_inst.inst);
3315 const decl = zir.getUnionDecl(src_inst.inst);
33123316 break :decl .{ decl.src_line, decl.src_column, decl.capture_names };
33133317 },
33143318 .reify_union => {
3315 const decl = zf.zir.?.extraData(
3319 const decl = zir.extraData(
33163320 std.zig.Zir.Inst.ReifyUnion,
33173321 inst.data.extended.operand,
33183322 ).data;
......@@ -3339,17 +3343,18 @@ fn genDeclInner(
33393343 break :done;
33403344 };
33413345 const zf = zcu.fileByIndex(src_inst.file);
3342 const inst = zf.zir.?.instructions.get(@backingInt(src_inst.inst));
3346 const zir = &zf.zir.?;
3347 const inst = zir.instructions.get(@backingInt(src_inst.inst));
33433348 const src_line, const src_column, const capture_names = decl: switch (inst.tag) {
33443349 else => unreachable,
33453350 .extended => switch (inst.data.extended.opcode) {
33463351 else => unreachable,
33473352 .enum_decl => {
3348 const decl = zf.zir.?.getEnumDecl(src_inst.inst);
3353 const decl = zir.getEnumDecl(src_inst.inst);
33493354 break :decl .{ decl.src_line, decl.src_column, decl.capture_names };
33503355 },
33513356 .reify_enum => {
3352 const decl = zf.zir.?.extraData(
3357 const decl = zir.extraData(
33533358 std.zig.Zir.Inst.ReifyEnum,
33543359 inst.data.extended.operand,
33553360 ).data;
......@@ -3390,9 +3395,10 @@ fn genDeclInner(
33903395 };
33913396 },
33923397 };
3398 const zir = &zf.zir.?;
33933399 if (maybe_name_nav.unwrap()) |name_ni| {
33943400 const name_nav = ip.getNav(name_ni);
3395 const decl = zf.zir.?.getDeclaration(name_nav.srcInst(ip).resolve(ip).?);
3401 const decl = zir.getDeclaration(name_nav.srcInst(ip).resolve(ip).?);
33963402 const parent_ni = try dwarf.getDecl(pt, ip.namespacePtr(
33973403 name_nav.analysis.?.namespace,
33983404 ).owner_type);
......@@ -3434,12 +3440,11 @@ fn genDeclInner(
34343440 .@"comptime", .runtime, .nav_val => try dwarf.strp(
34353441 &dwarf.debug_str,
34363442 di_nw,
3437 zf.zir.?.nullTerminatedString(capture_name),
3443 zir.nullTerminatedString(capture_name),
34383444 ),
34393445 .nav_ref => {
3440 const capture_name_slice = try zcu.gpa.print("&{s}", .{
3441 zf.zir.?.nullTerminatedString(capture_name),
3442 });
3446 const capture_name_slice =
3447 try zcu.gpa.print("&{s}", .{zir.nullTerminatedString(capture_name)});
34433448 defer zcu.gpa.free(capture_name_slice);
34443449 try dwarf.strp(&dwarf.debug_str, di_nw, capture_name_slice);
34453450 },
......@@ -3585,13 +3590,9 @@ fn blockConst(
35853590 const size = ty.abiSize(pt.zcu);
35863591 try nw.interface.writeUleb128(size);
35873592 const start = nw.interface.end;
3588 if (size > 0) try codegen.generateSymbol(
3589 dwarf.lf,
3590 pt,
3591 val,
3592 &nw.interface,
3593 .{ .atom_index = @bitCast(nw.ni) },
3594 );
3593 if (size > 0) try codegen.generateSymbol(dwarf.lf, pt, val, &nw.interface, .{
3594 .atom_index = @bitCast(nw.ni),
3595 });
35953596 assert(start + size == nw.interface.end);
35963597}
35973598
......@@ -3782,11 +3783,11 @@ pub const AbbrevCode = enum {
37823783 decl_const_runtime_bits,
37833784 decl_const_comptime_state,
37843785 decl_const_runtime_bits_comptime_state,
3785 decl_nullary_func,
3786 decl_empty_func,
37863787 decl_func,
3787 decl_nullary_func_generic,
3788 decl_empty_func_generic,
37883789 decl_func_generic,
3789 decl_extern_nullary_func,
3790 decl_extern_empty_func,
37903791 decl_extern_func,
37913792 decl_specification_empty_struct,
37923793 decl_specification_struct,
......@@ -3823,11 +3824,11 @@ pub const AbbrevCode = enum {
38233824 decl_instance_const_runtime_bits,
38243825 decl_instance_const_comptime_state,
38253826 decl_instance_const_runtime_bits_comptime_state,
3826 decl_instance_nullary_func,
3827 decl_instance_empty_func,
38273828 decl_instance_func,
3828 decl_instance_nullary_func_generic,
3829 decl_instance_empty_func_generic,
38293830 decl_instance_func_generic,
3830 decl_instance_extern_nullary_func,
3831 decl_instance_extern_empty_func,
38313832 decl_instance_extern_func,
38323833 // the rest are unrestricted other than empty variants must not be longer
38333834 // than the non-empty variant, and so should appear first
......@@ -3865,7 +3866,7 @@ pub const AbbrevCode = enum {
38653866 vector_type,
38663867 array_index,
38673868 array_len,
3868 nullary_func_type,
3869 empty_func_type,
38693870 func_type,
38703871 param,
38713872 unnamed_param,
......@@ -3882,7 +3883,7 @@ pub const AbbrevCode = enum {
38823883 comptime_capture_fully_comptime,
38833884 runtime_capture,
38843885 nav_capture,
3885 builtin_extern_nullary_func,
3886 builtin_extern_empty_func,
38863887 builtin_extern_func,
38873888 builtin_extern_var,
38883889 empty_block,
......@@ -4216,7 +4217,7 @@ pub const AbbrevCode = enum {
42164217 .{ .ZIG_comptime_value, .ref_addr },
42174218 },
42184219 },
4219 .decl_nullary_func = .{
4220 .decl_empty_func = .{
42204221 .tag = .subprogram,
42214222 .attrs = decl_attrs ++ .{
42224223 .{ .linkage_name, .strp },
......@@ -4241,11 +4242,10 @@ pub const AbbrevCode = enum {
42414242 .{ .noreturn, .flag },
42424243 },
42434244 },
4244 .decl_nullary_func_generic = .{
4245 .decl_empty_func_generic = .{
42454246 .tag = .subprogram,
42464247 .attrs = decl_attrs ++ .{
42474248 .{ .type, .ref_addr },
4248 .{ .noreturn, .flag },
42494249 },
42504250 },
42514251 .decl_func_generic = .{
......@@ -4255,7 +4255,7 @@ pub const AbbrevCode = enum {
42554255 .{ .type, .ref_addr },
42564256 },
42574257 },
4258 .decl_extern_nullary_func = .{
4258 .decl_extern_empty_func = .{
42594259 .tag = .subprogram,
42604260 .attrs = decl_attrs ++ .{
42614261 .{ .linkage_name, .strp },
......@@ -4486,7 +4486,7 @@ pub const AbbrevCode = enum {
44864486 .{ .ZIG_comptime_value, .ref_addr },
44874487 },
44884488 },
4489 .decl_instance_nullary_func = .{
4489 .decl_instance_empty_func = .{
44904490 .tag = .subprogram,
44914491 .attrs = decl_instance_attrs ++ .{
44924492 .{ .linkage_name, .strp },
......@@ -4511,7 +4511,7 @@ pub const AbbrevCode = enum {
45114511 .{ .noreturn, .flag },
45124512 },
45134513 },
4514 .decl_instance_nullary_func_generic = .{
4514 .decl_instance_empty_func_generic = .{
45154515 .tag = .subprogram,
45164516 .attrs = decl_instance_attrs ++ .{
45174517 .{ .type, .ref_addr },
......@@ -4524,7 +4524,7 @@ pub const AbbrevCode = enum {
45244524 .{ .type, .ref_addr },
45254525 },
45264526 },
4527 .decl_instance_extern_nullary_func = .{
4527 .decl_instance_extern_empty_func = .{
45284528 .tag = .subprogram,
45294529 .attrs = decl_instance_attrs ++ .{
45304530 .{ .linkage_name, .strp },
......@@ -4827,7 +4827,7 @@ pub const AbbrevCode = enum {
48274827 .{ .count, .udata },
48284828 },
48294829 },
4830 .nullary_func_type = .{
4830 .empty_func_type = .{
48314831 .tag = .subroutine_type,
48324832 .attrs = &.{
48334833 .{ .name, .strp },
......@@ -4946,7 +4946,7 @@ pub const AbbrevCode = enum {
49464946 .{ .location, .exprloc },
49474947 },
49484948 },
4949 .builtin_extern_nullary_func = .{
4949 .builtin_extern_empty_func = .{
49504950 .tag = .subprogram,
49514951 .attrs = &.{
49524952 .{ .ZIG_parent, .ref_addr },
src/link/Elf2.zig+1-1
......@@ -8933,7 +8933,7 @@ fn updateFuncInner(
89338933
89348934 const debug = &debug_output_buf;
89358935 debug.pt = pt;
8936 debug.any_children = false;
8936 debug.empty = true;
89378937 debug.blocks = .empty;
89388938 dwarf_func.state = .resolved;
89398939
src/main.zig+1-1
......@@ -5792,7 +5792,7 @@ fn cmdChangelist(arena: Allocator, io: Io, args: []const []const u8, environ_map
57925792 }
57935793
57945794 var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty;
5795 try Zcu.mapOldZirToNew(arena, old_zir, new_zir, &inst_map);
5795 try Zcu.mapOldZirToNew(arena, &old_zir, &new_zir, &inst_map);
57965796
57975797 var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer);
57985798 const stdout_bw = &stdout_writer.interface;
test/src/Debugger.zig+1-1
......@@ -1946,7 +1946,7 @@ pub fn addTests(db: *Debugger) void {
19461946 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:23:15
19471947 \\ frame #2: inline_call`root0.main at root0.zig:41:15
19481948 },
1949 .{ .skip_new_linker = true },
1949 .{},
19501950 );
19511951 db.addLldbTest(
19521952 "link_object",