| ... | @@ -2662,7 +2662,6 @@ fn initWipNavInner( | ... | @@ -2662,7 +2662,6 @@ fn initWipNavInner( |
| 2662 | try wip_nav.strp(@"extern".name.toSlice(ip)); | 2662 | try wip_nav.strp(@"extern".name.toSlice(ip)); |
| 2663 | try wip_nav.refType(.fromInterned(if (maybe_func_type) |func_type| func_type.return_type else @"extern".ty)); | 2663 | try wip_nav.refType(.fromInterned(if (maybe_func_type) |func_type| func_type.return_type else @"extern".ty)); |
| 2664 | if (maybe_func_type) |func_type| { | 2664 | if (maybe_func_type) |func_type| { |
| 2665 | try wip_nav.infoAddrSym(sym_index, 0); | | |
| 2666 | try diw.writeByte(@intFromBool(Type.fromInterned(func_type.return_type).isNoReturn(zcu))); | 2665 | try diw.writeByte(@intFromBool(Type.fromInterned(func_type.return_type).isNoReturn(zcu))); |
| 2667 | if (func_type.param_types.len > 0 or func_type.is_var_args) { | 2666 | if (func_type.param_types.len > 0 or func_type.is_var_args) { |
| 2668 | for (func_type.param_types.get(ip)) |param_type| { | 2667 | for (func_type.param_types.get(ip)) |param_type| { |
| ... | @@ -2672,7 +2671,7 @@ fn initWipNavInner( | ... | @@ -2672,7 +2671,7 @@ fn initWipNavInner( |
| 2672 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); | 2671 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); |
| 2673 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); | 2672 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); |
| 2674 | } | 2673 | } |
| 2675 | } else try wip_nav.infoExprLoc(.{ .addr_reloc = sym_index }); | 2674 | } |
| 2676 | }, | 2675 | }, |
| 2677 | .syntax => switch (ip.isFunctionType(@"extern".ty)) { | 2676 | .syntax => switch (ip.isFunctionType(@"extern".ty)) { |
| 2678 | false => continue :nav_val .{ .undef = @"extern".ty }, | 2677 | false => continue :nav_val .{ .undef = @"extern".ty }, |
| ... | @@ -2690,7 +2689,6 @@ fn initWipNavInner( | ... | @@ -2690,7 +2689,6 @@ fn initWipNavInner( |
| 2690 | }, &nav, inst_info.file, &decl); | 2689 | }, &nav, inst_info.file, &decl); |
| 2691 | try wip_nav.strp(@"extern".name.toSlice(ip)); | 2690 | try wip_nav.strp(@"extern".name.toSlice(ip)); |
| 2692 | try wip_nav.refType(.fromInterned(func_type.return_type)); | 2691 | try wip_nav.refType(.fromInterned(func_type.return_type)); |
| 2693 | try wip_nav.infoAddrSym(sym_index, 0); | | |
| 2694 | try diw.writeByte(@intFromBool(Type.fromInterned(func_type.return_type).isNoReturn(zcu))); | 2692 | try diw.writeByte(@intFromBool(Type.fromInterned(func_type.return_type).isNoReturn(zcu))); |
| 2695 | if (func_type.param_types.len > 0 or func_type.is_var_args) { | 2693 | if (func_type.param_types.len > 0 or func_type.is_var_args) { |
| 2696 | for (func_type.param_types.get(ip)) |param_type| { | 2694 | for (func_type.param_types.get(ip)) |param_type| { |
| ... | @@ -2817,13 +2815,19 @@ fn initWipNavInner( | ... | @@ -2817,13 +2815,19 @@ fn initWipNavInner( |
| 2817 | else => { | 2815 | else => { |
| 2818 | const diw = &wip_nav.debug_info.writer; | 2816 | const diw = &wip_nav.debug_info.writer; |
| 2819 | try wip_nav.declCommon(.{ | 2817 | try wip_nav.declCommon(.{ |
| 2820 | .decl = .decl_var, | 2818 | .decl = switch (decl.linkage) { |
| | 2819 | .@"extern" => .decl_extern_var, |
| | 2820 | else => .decl_var, |
| | 2821 | }, |
| 2821 | .decl_specification = switch (decl.kind) { | 2822 | .decl_specification = switch (decl.kind) { |
| 2822 | .unnamed_test, .@"test", .decltest, .@"comptime" => unreachable, | 2823 | .unnamed_test, .@"test", .decltest, .@"comptime" => unreachable, |
| 2823 | .@"const" => .decl_specification_const, | 2824 | .@"const" => .decl_specification_const, |
| 2824 | .@"var" => .decl_specification_var, | 2825 | .@"var" => .decl_specification_var, |
| 2825 | }, | 2826 | }, |
| 2826 | .decl_instance = .decl_instance_var, | 2827 | .decl_instance = switch (decl.linkage) { |
| | 2828 | .@"extern" => .decl_instance_extern_var, |
| | 2829 | else => .decl_instance_var, |
| | 2830 | }, |
| 2827 | }, &nav, inst_info.file, &decl); | 2831 | }, &nav, inst_info.file, &decl); |
| 2828 | try wip_nav.strp(switch (decl.linkage) { | 2832 | try wip_nav.strp(switch (decl.linkage) { |
| 2829 | .normal => nav.fqn, | 2833 | .normal => nav.fqn, |
| ... | @@ -2842,20 +2846,24 @@ fn initWipNavInner( | ... | @@ -2842,20 +2846,24 @@ fn initWipNavInner( |
| 2842 | .unnamed_test, .@"test", .decltest, .@"comptime" => unreachable, | 2846 | .unnamed_test, .@"test", .decltest, .@"comptime" => unreachable, |
| 2843 | .@"const" => { | 2847 | .@"const" => { |
| 2844 | const const_ty_reloc_index = try wip_nav.refForward(); | 2848 | const const_ty_reloc_index = try wip_nav.refForward(); |
| 2845 | try wip_nav.infoExprLoc(loc); | 2849 | if (decl.linkage != .@"extern") try wip_nav.infoExprLoc(loc); |
| 2846 | try diw.writeUleb128(nav.resolved.?.@"align".toByteUnits() orelse | 2850 | try diw.writeUleb128(nav.resolved.?.@"align".toByteUnits() orelse |
| 2847 | ty.abiAlignment(zcu).toByteUnits().?); | 2851 | ty.abiAlignment(zcu).toByteUnits().?); |
| 2848 | try diw.writeByte(@intFromBool(decl.linkage != .normal)); | 2852 | if (decl.linkage != .@"extern") { |
| | 2853 | try diw.writeByte(@intFromBool(decl.linkage != .normal)); |
| | 2854 | } |
| 2849 | wip_nav.finishForward(const_ty_reloc_index); | 2855 | wip_nav.finishForward(const_ty_reloc_index); |
| 2850 | try wip_nav.abbrevCode(.is_const); | 2856 | try wip_nav.abbrevCode(.is_const); |
| 2851 | try wip_nav.refType(ty); | 2857 | try wip_nav.refType(ty); |
| 2852 | }, | 2858 | }, |
| 2853 | .@"var" => { | 2859 | .@"var" => { |
| 2854 | try wip_nav.refType(ty); | 2860 | try wip_nav.refType(ty); |
| 2855 | try wip_nav.infoExprLoc(loc); | 2861 | if (decl.linkage != .@"extern") try wip_nav.infoExprLoc(loc); |
| 2856 | try diw.writeUleb128(nav.resolved.?.@"align".toByteUnits() orelse | 2862 | try diw.writeUleb128(nav.resolved.?.@"align".toByteUnits() orelse |
| 2857 | ty.abiAlignment(zcu).toByteUnits().?); | 2863 | ty.abiAlignment(zcu).toByteUnits().?); |
| 2858 | try diw.writeByte(@intFromBool(decl.linkage != .normal)); | 2864 | if (decl.linkage != .@"extern") { |
| | 2865 | try diw.writeByte(@intFromBool(decl.linkage != .normal)); |
| | 2866 | } |
| 2859 | }, | 2867 | }, |
| 2860 | } | 2868 | } |
| 2861 | }, | 2869 | }, |
| ... | @@ -5138,6 +5146,7 @@ const AbbrevCode = enum { | ... | @@ -5138,6 +5146,7 @@ const AbbrevCode = enum { |
| 5138 | decl_union, | 5146 | decl_union, |
| 5139 | decl_packed_union, | 5147 | decl_packed_union, |
| 5140 | decl_var, | 5148 | decl_var, |
| | 5149 | decl_extern_var, |
| 5141 | decl_const, | 5150 | decl_const, |
| 5142 | decl_const_runtime_bits, | 5151 | decl_const_runtime_bits, |
| 5143 | decl_const_comptime_state, | 5152 | decl_const_comptime_state, |
| ... | @@ -5160,6 +5169,7 @@ const AbbrevCode = enum { | ... | @@ -5160,6 +5169,7 @@ const AbbrevCode = enum { |
| 5160 | decl_instance_union, | 5169 | decl_instance_union, |
| 5161 | decl_instance_packed_union, | 5170 | decl_instance_packed_union, |
| 5162 | decl_instance_var, | 5171 | decl_instance_var, |
| | 5172 | decl_instance_extern_var, |
| 5163 | decl_instance_const, | 5173 | decl_instance_const, |
| 5164 | decl_instance_const_runtime_bits, | 5174 | decl_instance_const_runtime_bits, |
| 5165 | decl_instance_const_comptime_state, | 5175 | decl_instance_const_comptime_state, |
| ... | @@ -5360,6 +5370,15 @@ const AbbrevCode = enum { | ... | @@ -5360,6 +5370,15 @@ const AbbrevCode = enum { |
| 5360 | .{ .external, .flag }, | 5370 | .{ .external, .flag }, |
| 5361 | }, | 5371 | }, |
| 5362 | }, | 5372 | }, |
| | 5373 | .decl_extern_var = .{ |
| | 5374 | .tag = .variable, |
| | 5375 | .attrs = decl_abbrev_common_attrs ++ .{ |
| | 5376 | .{ .linkage_name, .strp }, |
| | 5377 | .{ .type, .ref_addr }, |
| | 5378 | .{ .alignment, .udata }, |
| | 5379 | .{ .external, .flag_present }, |
| | 5380 | }, |
| | 5381 | }, |
| 5363 | .decl_const = .{ | 5382 | .decl_const = .{ |
| 5364 | .tag = .constant, | 5383 | .tag = .constant, |
| 5365 | .attrs = decl_abbrev_common_attrs ++ .{ | 5384 | .attrs = decl_abbrev_common_attrs ++ .{ |
| ... | @@ -5443,7 +5462,6 @@ const AbbrevCode = enum { | ... | @@ -5443,7 +5462,6 @@ const AbbrevCode = enum { |
| 5443 | .attrs = decl_abbrev_common_attrs ++ .{ | 5462 | .attrs = decl_abbrev_common_attrs ++ .{ |
| 5444 | .{ .linkage_name, .strp }, | 5463 | .{ .linkage_name, .strp }, |
| 5445 | .{ .type, .ref_addr }, | 5464 | .{ .type, .ref_addr }, |
| 5446 | .{ .low_pc, .addr }, | | |
| 5447 | .{ .external, .flag_present }, | 5465 | .{ .external, .flag_present }, |
| 5448 | .{ .noreturn, .flag }, | 5466 | .{ .noreturn, .flag }, |
| 5449 | }, | 5467 | }, |
| ... | @@ -5454,7 +5472,6 @@ const AbbrevCode = enum { | ... | @@ -5454,7 +5472,6 @@ const AbbrevCode = enum { |
| 5454 | .attrs = decl_abbrev_common_attrs ++ .{ | 5472 | .attrs = decl_abbrev_common_attrs ++ .{ |
| 5455 | .{ .linkage_name, .strp }, | 5473 | .{ .linkage_name, .strp }, |
| 5456 | .{ .type, .ref_addr }, | 5474 | .{ .type, .ref_addr }, |
| 5457 | .{ .low_pc, .addr }, | | |
| 5458 | .{ .external, .flag_present }, | 5475 | .{ .external, .flag_present }, |
| 5459 | .{ .noreturn, .flag }, | 5476 | .{ .noreturn, .flag }, |
| 5460 | }, | 5477 | }, |
| ... | @@ -5536,6 +5553,15 @@ const AbbrevCode = enum { | ... | @@ -5536,6 +5553,15 @@ const AbbrevCode = enum { |
| 5536 | .{ .external, .flag }, | 5553 | .{ .external, .flag }, |
| 5537 | }, | 5554 | }, |
| 5538 | }, | 5555 | }, |
| | 5556 | .decl_instance_extern_var = .{ |
| | 5557 | .tag = .variable, |
| | 5558 | .attrs = decl_instance_abbrev_common_attrs ++ .{ |
| | 5559 | .{ .linkage_name, .strp }, |
| | 5560 | .{ .location, .exprloc }, |
| | 5561 | .{ .alignment, .udata }, |
| | 5562 | .{ .external, .flag_present }, |
| | 5563 | }, |
| | 5564 | }, |
| 5539 | .decl_instance_const = .{ | 5565 | .decl_instance_const = .{ |
| 5540 | .tag = .constant, | 5566 | .tag = .constant, |
| 5541 | .attrs = decl_instance_abbrev_common_attrs ++ .{ | 5567 | .attrs = decl_instance_abbrev_common_attrs ++ .{ |
| ... | @@ -5619,7 +5645,6 @@ const AbbrevCode = enum { | ... | @@ -5619,7 +5645,6 @@ const AbbrevCode = enum { |
| 5619 | .attrs = decl_instance_abbrev_common_attrs ++ .{ | 5645 | .attrs = decl_instance_abbrev_common_attrs ++ .{ |
| 5620 | .{ .linkage_name, .strp }, | 5646 | .{ .linkage_name, .strp }, |
| 5621 | .{ .type, .ref_addr }, | 5647 | .{ .type, .ref_addr }, |
| 5622 | .{ .low_pc, .addr }, | | |
| 5623 | .{ .external, .flag_present }, | 5648 | .{ .external, .flag_present }, |
| 5624 | .{ .noreturn, .flag }, | 5649 | .{ .noreturn, .flag }, |
| 5625 | }, | 5650 | }, |
| ... | @@ -5630,7 +5655,6 @@ const AbbrevCode = enum { | ... | @@ -5630,7 +5655,6 @@ const AbbrevCode = enum { |
| 5630 | .attrs = decl_instance_abbrev_common_attrs ++ .{ | 5655 | .attrs = decl_instance_abbrev_common_attrs ++ .{ |
| 5631 | .{ .linkage_name, .strp }, | 5656 | .{ .linkage_name, .strp }, |
| 5632 | .{ .type, .ref_addr }, | 5657 | .{ .type, .ref_addr }, |
| 5633 | .{ .low_pc, .addr }, | | |
| 5634 | .{ .external, .flag_present }, | 5658 | .{ .external, .flag_present }, |
| 5635 | .{ .noreturn, .flag }, | 5659 | .{ .noreturn, .flag }, |
| 5636 | }, | 5660 | }, |
| ... | @@ -6048,7 +6072,6 @@ const AbbrevCode = enum { | ... | @@ -6048,7 +6072,6 @@ const AbbrevCode = enum { |
| 6048 | .{ .ZIG_parent, .ref_addr }, | 6072 | .{ .ZIG_parent, .ref_addr }, |
| 6049 | .{ .linkage_name, .strp }, | 6073 | .{ .linkage_name, .strp }, |
| 6050 | .{ .type, .ref_addr }, | 6074 | .{ .type, .ref_addr }, |
| 6051 | .{ .low_pc, .addr }, | | |
| 6052 | .{ .external, .flag_present }, | 6075 | .{ .external, .flag_present }, |
| 6053 | .{ .noreturn, .flag }, | 6076 | .{ .noreturn, .flag }, |
| 6054 | }, | 6077 | }, |
| ... | @@ -6060,7 +6083,6 @@ const AbbrevCode = enum { | ... | @@ -6060,7 +6083,6 @@ const AbbrevCode = enum { |
| 6060 | .{ .ZIG_parent, .ref_addr }, | 6083 | .{ .ZIG_parent, .ref_addr }, |
| 6061 | .{ .linkage_name, .strp }, | 6084 | .{ .linkage_name, .strp }, |
| 6062 | .{ .type, .ref_addr }, | 6085 | .{ .type, .ref_addr }, |
| 6063 | .{ .low_pc, .addr }, | | |
| 6064 | .{ .external, .flag_present }, | 6086 | .{ .external, .flag_present }, |
| 6065 | .{ .noreturn, .flag }, | 6087 | .{ .noreturn, .flag }, |
| 6066 | }, | 6088 | }, |
| ... | @@ -6071,7 +6093,6 @@ const AbbrevCode = enum { | ... | @@ -6071,7 +6093,6 @@ const AbbrevCode = enum { |
| 6071 | .{ .ZIG_parent, .ref_addr }, | 6093 | .{ .ZIG_parent, .ref_addr }, |
| 6072 | .{ .linkage_name, .strp }, | 6094 | .{ .linkage_name, .strp }, |
| 6073 | .{ .type, .ref_addr }, | 6095 | .{ .type, .ref_addr }, |
| 6074 | .{ .location, .exprloc }, | | |
| 6075 | .{ .external, .flag_present }, | 6096 | .{ .external, .flag_present }, |
| 6076 | }, | 6097 | }, |
| 6077 | }, | 6098 | }, |