authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-05 23:57:23-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-07 16:11:00-04:00
logf6d272651274897c10a75f12a2f146ad27f08628
tree43312c2d0d7947e19e508a5943e24cce1706bcec
parentefa11ce196bc1c60b34b41ab8b14be23825b45dc

Dwarf2: implement comptime globals


2 files changed, 445 insertions(+), 23 deletions(-)

src/link/Dwarf2.zig+434-13
......@@ -3037,7 +3037,21 @@ fn updateConstInner(
30373037 });
30383038 },
30393039
3040 else => return,
3040 .undef => |ty| {
3041 try dwarf.abbrevCode(di_nw, .undefined_comptime_value);
3042 try dwarf.refType(pt, di_nw, .fromInterned(ty));
3043 },
3044 .simple_value => |simple_value| switch (simple_value) {
3045 .void => unreachable, // opv state
3046 .true, .false => unreachable, // runtime bits
3047 .@"unreachable" => unreachable, // not a value
3048 .null => {
3049 // TODO: proper representation for this
3050 try dwarf.abbrevCode(di_nw, .undefined_comptime_value);
3051 try dwarf.refType(pt, di_nw, .null);
3052 },
3053 },
3054 .@"extern" => unreachable,
30413055 .func => |func| {
30423056 const func_type = ip.indexToKey(func.ty).func_type;
30433057 const nav = ip.getNav(func.owner_nav);
......@@ -3069,17 +3083,424 @@ fn updateConstInner(
30693083 if (func_type.is_var_args) try dwarf.abbrevCode(di_nw, .is_var_args);
30703084 if (!empty) try di_w.writeUleb128(@backingInt(AbbrevCode.null));
30713085 },
3086 .int => |int| {
3087 var big_int_space: Value.BigIntSpace = undefined;
3088 try dwarf.abbrevCode(di_nw, .comptime_value);
3089 try dwarf.refType(pt, di_nw, .fromInterned(int.ty));
3090 try dwarf.bigIntConstValue(
3091 di_w,
3092 .fromInterned(int.ty),
3093 Value.fromInterned(val).toBigInt(&big_int_space, zcu),
3094 );
3095 },
3096 .bitpack => |bitpack| {
3097 var big_int_space: Value.BigIntSpace = undefined;
3098 const backing_int_val: Value = .fromInterned(bitpack.backing_int_val);
3099 try dwarf.abbrevCode(di_nw, .comptime_value);
3100 try dwarf.refType(pt, di_nw, .fromInterned(bitpack.ty));
3101 try dwarf.bigIntConstValue(
3102 di_w,
3103 backing_int_val.typeOf(zcu),
3104 backing_int_val.toBigInt(&big_int_space, zcu),
3105 );
3106 },
3107 .err => |err| {
3108 try dwarf.abbrevCode(di_nw, .comptime_value);
3109 try dwarf.refType(pt, di_nw, .fromInterned(err.ty));
3110 try di_w.writeUleb128(DW.FORM.udata);
3111 try di_w.writeUleb128(try pt.getErrorValue(err.name));
3112 },
3113 .error_union => |error_union| {
3114 try dwarf.abbrevCode(di_nw, .aggregate_undefined_comptime_value);
3115 try dwarf.refType(pt, di_nw, .fromInterned(error_union.ty));
3116 var err_buf: [4]u8 = undefined;
3117 const err_bytes = err_buf[0..@divCeil(zcu.errorSetBits(), 8)];
3118 const err_val = switch (error_union.val) {
3119 .err_name => |err_name| try pt.getErrorValue(err_name),
3120 .payload => 0,
3121 };
3122 switch (err_bytes.len) {
3123 else => unreachable,
3124 inline 0...4 => |len| std.mem.writeInt(
3125 @Int(.unsigned, 8 * len),
3126 err_bytes[0..len],
3127 @intCast(err_val),
3128 dwarf.endian,
3129 ),
3130 }
3131 {
3132 try dwarf.abbrevCode(di_nw, .comptime_value_field_runtime);
3133 try dwarf.strp(&dwarf.debug_str, di_nw, "is_error");
3134 try di_w.writeUleb128(err_bytes.len);
3135 try di_w.writeAll(err_bytes);
3136 }
3137 payload_field: switch (error_union.val) {
3138 .err_name => {},
3139 .payload => |payload_val| {
3140 const payload_ty: Type = .fromInterned(ip.typeOf(payload_val));
3141 const payload_class = payload_ty.classify(zcu);
3142 try dwarf.abbrevCode(di_nw, if (payload_class.comptimeOnly())
3143 .comptime_value_field_comptime
3144 else if (payload_class.hasRuntimeBits())
3145 .comptime_value_field_runtime
3146 else
3147 break :payload_field);
3148 try dwarf.strp(&dwarf.debug_str, di_nw, "value");
3149 if (payload_class.comptimeOnly())
3150 try dwarf.refConst(pt, di_nw, .fromInterned(payload_val))
3151 else if (payload_class.hasRuntimeBits())
3152 try dwarf.blockConst(pt, di_nw, .fromInterned(payload_val))
3153 else
3154 unreachable;
3155 },
3156 }
3157 {
3158 try dwarf.abbrevCode(di_nw, .comptime_value_field_runtime);
3159 try dwarf.strp(&dwarf.debug_str, di_nw, "error");
3160 try di_w.writeUleb128(err_bytes.len);
3161 try di_w.writeAll(err_bytes);
3162 }
3163 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
3164 },
3165 .enum_literal => |enum_literal| {
3166 try dwarf.abbrevCode(di_nw, .comptime_value);
3167 try dwarf.refType(pt, di_nw, .enum_literal);
3168 try di_w.writeUleb128(DW.FORM.strp);
3169 try dwarf.strp(&dwarf.debug_str, di_nw, enum_literal.toSlice(ip));
3170 },
3171 .enum_tag => |enum_tag| {
3172 var big_int_space: Value.BigIntSpace = undefined;
3173 const int = ip.indexToKey(enum_tag.int).int;
3174 try dwarf.abbrevCode(di_nw, .comptime_value);
3175 try dwarf.refType(pt, di_nw, .fromInterned(enum_tag.ty));
3176 try dwarf.bigIntConstValue(
3177 di_w,
3178 .fromInterned(int.ty),
3179 Value.fromInterned(val).toBigInt(&big_int_space, zcu),
3180 );
3181 },
3182 .float => |float| {
3183 try dwarf.abbrevCode(di_nw, .comptime_value);
3184 try dwarf.refType(pt, di_nw, .fromInterned(float.ty));
3185 switch (float.storage) {
3186 .f16 => |f16_val| {
3187 try di_w.writeUleb128(DW.FORM.data2);
3188 try di_w.writeInt(u16, @bitCast(f16_val), dwarf.endian);
3189 },
3190 .f32 => |f32_val| {
3191 try di_w.writeUleb128(DW.FORM.data4);
3192 try di_w.writeInt(u32, @bitCast(f32_val), dwarf.endian);
3193 },
3194 .f64 => |f64_val| {
3195 try di_w.writeUleb128(DW.FORM.data8);
3196 try di_w.writeInt(u64, @bitCast(f64_val), dwarf.endian);
3197 },
3198 .f80 => |f80_val| {
3199 try di_w.writeUleb128(DW.FORM.block);
3200 try di_w.writeUleb128(@divExact(80, 8));
3201 try di_w.writeInt(u80, @bitCast(f80_val), dwarf.endian);
3202 },
3203 .f128 => |f128_val| {
3204 try di_w.writeUleb128(DW.FORM.data16);
3205 try di_w.writeInt(u128, @bitCast(f128_val), dwarf.endian);
3206 },
3207 }
3208 },
3209 .ptr => |ptr| {
3210 const Access = union(enum) {
3211 index: u64,
3212 field: InternPool.NullTerminatedString,
3213 synthetic_field: []const u8,
3214 tuple_index: u32,
3215 };
3216 var zero_bit_accesses: std.ArrayList(Access) = .empty;
3217 defer zero_bit_accesses.deinit(zcu.gpa);
3218 location: {
3219 var base_addr = ptr.base_addr;
3220 var byte_offset = ptr.byte_offset;
3221 const base_ni = while (true) {
3222 const base_ptr, const access: Access = base_ptr_access: switch (base_addr) {
3223 .nav => |ni| break (try dwarf.getGlobal(ni)).get(dwarf).debug_info_ni,
3224 .comptime_alloc, .comptime_field => unreachable,
3225 .uav => |uav| {
3226 const uav_ty: Type = .fromInterned(ip.typeOf(uav.val));
3227 if (uav_ty.classify(zcu) == .one_possible_value) {
3228 try dwarf.abbrevCode(di_nw, if (zero_bit_accesses.items.len > 0)
3229 .aggregate_comptime_value
3230 else
3231 .comptime_value);
3232 try dwarf.refType(pt, di_nw, .fromInterned(ptr.ty));
3233 try di_w.writeUleb128(DW.FORM.udata);
3234 try di_w.writeUleb128(ip.indexToKey(uav.orig_ty)
3235 .ptr_type.flags.alignment.toByteUnits() orelse
3236 uav_ty.abiAlignment(zcu).toByteUnits().?);
3237 break :location;
3238 } else break Const.get(try dwarf.getConst(pt, .fromInterned(
3239 uav.val,
3240 )), dwarf).debug_info_ni;
3241 },
3242 .int => {
3243 try dwarf.abbrevCode(di_nw, if (zero_bit_accesses.items.len > 0)
3244 .aggregate_comptime_value
3245 else
3246 .comptime_value);
3247 try dwarf.refType(pt, di_nw, .fromInterned(ptr.ty));
3248 try di_w.writeUleb128(DW.FORM.udata);
3249 try di_w.writeUleb128(byte_offset);
3250 break :location;
3251 },
3252 .eu_payload => |eu_ptr| {
3253 const base_ptr = ip.indexToKey(eu_ptr).ptr;
3254 byte_offset += codegen.errUnionPayloadOffset(.fromInterned(ip.indexToKey(
3255 ip.indexToKey(base_ptr.ty).ptr_type.child,
3256 ).error_union_type.payload_type), zcu);
3257 break :base_ptr_access .{ base_ptr, .{ .synthetic_field = "value" } };
3258 },
3259 .opt_payload => |opt_ptr| .{ ip.indexToKey(opt_ptr).ptr, .{
3260 .synthetic_field = "?",
3261 } },
3262 .field => |field| {
3263 const base_ptr = ip.indexToKey(field.base).ptr;
3264 const agg_ty: Type =
3265 .fromInterned(ip.indexToKey(base_ptr.ty).ptr_type.child);
3266 break :base_ptr_access .{
3267 base_ptr,
3268 if (agg_ty.isSlice(zcu)) .{ .synthetic_field = switch (field.index) {
3269 Value.slice_ptr_index => "ptr",
3270 Value.slice_len_index => "len",
3271 else => unreachable,
3272 } } else if (agg_ty.structFieldName(
3273 @intCast(field.index),
3274 zcu,
3275 ).unwrap()) |field_name|
3276 .{ .field = field_name }
3277 else
3278 .{ .tuple_index = @intCast(field.index) },
3279 };
3280 },
3281 .arr_elem => |arr_elem| .{
3282 ip.indexToKey(arr_elem.base).ptr,
3283 .{ .index = arr_elem.index },
3284 },
3285 };
3286 base_addr = base_ptr.base_addr;
3287 byte_offset += base_ptr.byte_offset;
3288 if (Type.fromInterned(
3289 ip.indexToKey(base_ptr.ty).ptr_type.child,
3290 ).hasRuntimeBits(zcu))
3291 assert(access != .index)
3292 else
3293 try zero_bit_accesses.append(zcu.gpa, access);
3294 };
3295 try dwarf.abbrevCode(di_nw, if (zero_bit_accesses.items.len > 0)
3296 .aggregate_location_comptime_value
3297 else
3298 .location_comptime_value);
3299 try dwarf.refType(pt, di_nw, .fromInterned(ptr.ty));
3300 try dwarf.exprLoc(di_nw, .{ .implicit_pointer = .{
3301 .node = base_ni.unwrap().?,
3302 .offset = byte_offset,
3303 } });
3304 }
3305 if (zero_bit_accesses.items.len > 0) {
3306 for (zero_bit_accesses.items) |access| switch (access) {
3307 .index => |index| {
3308 try dwarf.abbrevCode(di_nw, .array_index);
3309 try di_w.writeUleb128(index);
3310 },
3311 .field => |field| {
3312 try dwarf.abbrevCode(di_nw, .access);
3313 try dwarf.strp(&dwarf.debug_str, di_nw, field.toSlice(ip));
3314 },
3315 .synthetic_field => |field| {
3316 try dwarf.abbrevCode(di_nw, .access);
3317 try dwarf.strp(&dwarf.debug_str, di_nw, field);
3318 },
3319 .tuple_index => |index| {
3320 try dwarf.abbrevCode(di_nw, .access);
3321 var field_name_buf: [std.fmt.count("{d}", .{std.math.maxInt(u32)})]u8 =
3322 undefined;
3323 const field_name = std.mem.print(&field_name_buf, "{d}", .{index}) catch
3324 unreachable;
3325 try dwarf.strp(&dwarf.debug_str, di_nw, field_name);
3326 },
3327 };
3328 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
3329 }
3330 },
3331 .slice => |slice| {
3332 try dwarf.abbrevCode(di_nw, .aggregate_undefined_comptime_value);
3333 try dwarf.refType(pt, di_nw, .fromInterned(slice.ty));
3334 {
3335 try dwarf.abbrevCode(di_nw, .comptime_value_field_comptime);
3336 try dwarf.strp(&dwarf.debug_str, di_nw, "ptr");
3337 try dwarf.refConst(pt, di_nw, .fromInterned(slice.ptr));
3338 }
3339 {
3340 try dwarf.abbrevCode(di_nw, .comptime_value_field_runtime);
3341 try dwarf.strp(&dwarf.debug_str, di_nw, "len");
3342 try dwarf.blockConst(pt, di_nw, .fromInterned(slice.len));
3343 }
3344 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
3345 },
3346 .opt => |opt| {
3347 const opt_child_ty: Type = .fromInterned(ip.indexToKey(opt.ty).opt_type);
3348 try dwarf.abbrevCode(di_nw, .aggregate_undefined_comptime_value);
3349 try dwarf.refType(pt, di_nw, .fromInterned(opt.ty));
3350 {
3351 try dwarf.abbrevCode(di_nw, .comptime_value_field_runtime);
3352 try dwarf.strp(&dwarf.debug_str, di_nw, "has_value");
3353 switch (optRepr(opt_child_ty, zcu)) {
3354 .opv_null => try di_w.writeUleb128(0),
3355 .unpacked => try dwarf.blockConst(pt, di_nw, .makeBool(opt.val != .none)),
3356 .error_set, .pointer => try dwarf.blockConst(pt, di_nw, .fromInterned(val)),
3357 }
3358 }
3359 if (opt.val != .none) child_field: {
3360 const opt_child_class = opt_child_ty.classify(zcu);
3361 try dwarf.abbrevCode(di_nw, if (opt_child_class.comptimeOnly())
3362 .comptime_value_field_comptime
3363 else if (opt_child_class.hasRuntimeBits())
3364 .comptime_value_field_runtime
3365 else
3366 break :child_field);
3367 try dwarf.strp(&dwarf.debug_str, di_nw, "?");
3368 if (opt_child_class.comptimeOnly())
3369 try dwarf.refConst(pt, di_nw, .fromInterned(opt.val))
3370 else if (opt_child_class.hasRuntimeBits())
3371 try dwarf.blockConst(pt, di_nw, .fromInterned(opt.val))
3372 else
3373 unreachable;
3374 }
3375 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
3376 },
3377 .aggregate => |aggregate| {
3378 try dwarf.abbrevCode(di_nw, .aggregate_undefined_comptime_value);
3379 try dwarf.refType(pt, di_nw, .fromInterned(aggregate.ty));
3380 switch (ip.indexToKey(aggregate.ty)) {
3381 .struct_type => {
3382 const loaded_struct = ip.loadStructType(aggregate.ty);
3383 assert(loaded_struct.layout == .auto);
3384 for (0..loaded_struct.field_types.len) |field_index| {
3385 if (loaded_struct.field_is_comptime_bits.get(ip, field_index)) continue;
3386 const field_ty: Type =
3387 .fromInterned(loaded_struct.field_types.get(ip)[field_index]);
3388 const field_class = field_ty.classify(zcu);
3389 try dwarf.abbrevCode(di_nw, if (field_class.comptimeOnly())
3390 .comptime_value_field_comptime
3391 else if (field_class.hasRuntimeBits())
3392 .comptime_value_field_runtime
3393 else
3394 continue);
3395 try dwarf.strp(
3396 &dwarf.debug_str,
3397 di_nw,
3398 loaded_struct.field_names.get(ip)[field_index].toSlice(ip),
3399 );
3400 const field_value: Value = .fromInterned(switch (aggregate.storage) {
3401 .bytes => unreachable,
3402 .elems => |elems| elems[field_index],
3403 .repeated_elem => |repeated_elem| repeated_elem,
3404 });
3405 if (field_class.comptimeOnly())
3406 try dwarf.refConst(pt, di_nw, field_value)
3407 else if (field_class.hasRuntimeBits())
3408 try dwarf.blockConst(pt, di_nw, field_value)
3409 else
3410 unreachable;
3411 }
3412 },
3413 .tuple_type => |tuple_type| for (0..tuple_type.types.len) |field_index| {
3414 if (tuple_type.values.get(ip)[field_index] != .none) continue;
3415 const field_ty: Type = .fromInterned(tuple_type.types.get(ip)[field_index]);
3416 const field_class = field_ty.classify(zcu);
3417 try dwarf.abbrevCode(di_nw, if (field_class.comptimeOnly())
3418 .comptime_value_field_comptime
3419 else if (field_class.hasRuntimeBits())
3420 .comptime_value_field_runtime
3421 else
3422 continue);
3423 {
3424 var field_name_buf: [std.fmt.count("{d}", .{std.math.maxInt(u32)})]u8 =
3425 undefined;
3426 const field_name = std.mem.print(&field_name_buf, "{d}", .{field_index}) catch
3427 unreachable;
3428 try dwarf.strp(&dwarf.debug_str, di_nw, field_name);
3429 }
3430 const field_value: Value = .fromInterned(switch (aggregate.storage) {
3431 .bytes => unreachable,
3432 .elems => |elems| elems[field_index],
3433 .repeated_elem => |repeated_elem| repeated_elem,
3434 });
3435 if (field_class.comptimeOnly())
3436 try dwarf.refConst(pt, di_nw, field_value)
3437 else if (field_class.hasRuntimeBits())
3438 try dwarf.blockConst(pt, di_nw, field_value)
3439 else
3440 unreachable;
3441 },
3442 inline .array_type, .vector_type => |sequence_type| {
3443 const child_ty: Type = .fromInterned(sequence_type.child);
3444 const child_class = child_ty.classify(zcu);
3445 for (switch (aggregate.storage) {
3446 .bytes => unreachable,
3447 .elems => |elems| elems,
3448 .repeated_elem => |*repeated_elem| repeated_elem[0..1],
3449 }) |elem| {
3450 try dwarf.abbrevCode(di_nw, if (child_class.comptimeOnly())
3451 .comptime_value_elem_comptime
3452 else if (child_class.hasRuntimeBits())
3453 .comptime_value_elem_runtime
3454 else
3455 break);
3456 if (child_class.comptimeOnly())
3457 try dwarf.refConst(pt, di_nw, .fromInterned(elem))
3458 else if (child_class.hasRuntimeBits())
3459 try dwarf.blockConst(pt, di_nw, .fromInterned(elem))
3460 else
3461 unreachable;
3462 }
3463 },
3464 else => unreachable,
3465 }
3466 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
3467 },
3468 .un => |un| {
3469 try dwarf.abbrevCode(di_nw, .aggregate_undefined_comptime_value);
3470 try dwarf.refType(pt, di_nw, .fromInterned(un.ty));
3471 {
3472 const loaded_union = ip.loadUnionType(un.ty);
3473 assert(loaded_union.layout == .auto);
3474 const field_index = zcu.unionTagFieldIndex(loaded_union, Value.fromInterned(un.tag)).?;
3475 const field_ty: Type = .fromInterned(loaded_union.field_types.get(ip)[field_index]);
3476 const field_class = field_ty.classify(zcu);
3477 const field_name =
3478 ip.loadEnumType(loaded_union.enum_tag_type).field_names.get(ip)[field_index];
3479 try dwarf.abbrevCode(di_nw, if (field_class.comptimeOnly())
3480 .comptime_value_field_comptime
3481 else if (field_class.hasRuntimeBits())
3482 .comptime_value_field_runtime
3483 else
3484 .access);
3485 try dwarf.strp(&dwarf.debug_str, di_nw, field_name.toSlice(ip));
3486 if (field_class.comptimeOnly())
3487 try dwarf.refConst(pt, di_nw, .fromInterned(un.val))
3488 else if (field_class.hasRuntimeBits())
3489 try dwarf.blockConst(pt, di_nw, .fromInterned(un.val));
3490 }
3491 try di_w.writeUleb128(@backingInt(AbbrevCode.null));
3492 },
30723493
30733494 .memoized_call => unreachable, // not a value
30743495 }
30753496 try dwarf.genDebugInfoPadding(di_w, di_w.unusedCapacityLen());
30763497}
30773498
3078fn optRepr(opt_child_type: Type, zcu: *const Zcu) enum { unpacked, opv_null, error_set, pointer } {
3079 if (opt_child_type.isNoReturn(zcu)) return .opv_null;
3080 return switch (opt_child_type.toIntern()) {
3499fn optRepr(opt_child_ty: Type, zcu: *const Zcu) enum { unpacked, opv_null, error_set, pointer } {
3500 if (opt_child_ty.isNoReturn(zcu)) return .opv_null;
3501 return switch (opt_child_ty.toIntern()) {
30813502 .anyerror_type => .error_set,
3082 else => switch (zcu.intern_pool.indexToKey(opt_child_type.toIntern())) {
3503 else => switch (zcu.intern_pool.indexToKey(opt_child_ty.toIntern())) {
30833504 else => .unpacked,
30843505 .error_set_type, .inferred_error_set_type => .error_set,
30853506 .ptr_type => |ptr_type| if (ptr_type.flags.is_allowzero) .unpacked else .pointer,
......@@ -4096,10 +4517,10 @@ pub const AbbrevCode = enum {
40964517 aggregate_undefined_comptime_value,
40974518 aggregate_comptime_value,
40984519 aggregate_location_comptime_value,
4099 comptime_value_field_runtime_bits,
4100 comptime_value_field_comptime_state,
4101 comptime_value_elem_runtime_bits,
4102 comptime_value_elem_comptime_state,
4520 comptime_value_field_runtime,
4521 comptime_value_field_comptime,
4522 comptime_value_elem_runtime,
4523 comptime_value_elem_comptime,
41034524
41044525 const decl_size = uleb128Size(@backingInt(AbbrevCode.decl_instance_extern_func));
41054526 comptime {
......@@ -5384,27 +5805,27 @@ pub const AbbrevCode = enum {
53845805 .{ .location, .exprloc },
53855806 },
53865807 },
5387 .comptime_value_field_runtime_bits = .{
5808 .comptime_value_field_runtime = .{
53885809 .tag = .member,
53895810 .attrs = &.{
53905811 .{ .name, .strp },
53915812 .{ .const_value, .block },
53925813 },
53935814 },
5394 .comptime_value_field_comptime_state = .{
5815 .comptime_value_field_comptime = .{
53955816 .tag = .member,
53965817 .attrs = &.{
53975818 .{ .name, .strp },
53985819 .{ .ZIG_comptime_value, .ref_addr },
53995820 },
54005821 },
5401 .comptime_value_elem_runtime_bits = .{
5822 .comptime_value_elem_runtime = .{
54025823 .tag = .member,
54035824 .attrs = &.{
54045825 .{ .const_value, .block },
54055826 },
54065827 },
5407 .comptime_value_elem_comptime_state = .{
5828 .comptime_value_elem_comptime = .{
54085829 .tag = .member,
54095830 .attrs = &.{
54105831 .{ .ZIG_comptime_value, .ref_addr },
src/link/Elf2.zig+11-10
......@@ -8773,17 +8773,18 @@ fn updateConstInner(
87738773 switch (elf.base.comp.config.debug_format) {
87748774 .strip => {},
87758775 .dwarf => {
8776 switch (pt.zcu.intern_pool.indexToKey(val)) {
8777 else => {},
8778 .@"extern" => return,
8779 .func => |func| {
8780 const fi = try elf.dwarf.getFunc(func.owner_nav);
8781 switch (fi.get(&elf.dwarf).state) {
8782 .unresolved => {},
8783 .resolved => return,
8784 }
8785 },
8786 }
87768787 {
8777 switch (pt.zcu.intern_pool.indexToKey(val)) {
8778 else => {},
8779 .func => |func| {
8780 const fi = try elf.dwarf.getFunc(func.owner_nav);
8781 switch (fi.get(&elf.dwarf).state) {
8782 .unresolved => {},
8783 .resolved => return,
8784 }
8785 },
8786 }
87878788 const gpa = elf.base.comp.gpa;
87888789 const debug_info_ni = Dwarf.Const.get(cpi, &elf.dwarf).debug_info_ni.unwrap().?;
87898790 try debug_info_ni.moved(gpa, &elf.mf);