From ef11bc9899002620d67cfce9c79b6c0dc0f5ea61 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Tue, 6 Aug 2024 11:22:37 -0400 Subject: Dwarf: rework self-hosted debug info from scratch This is in preparation for incremental and actually being able to debug executables built by the x86_64 backend. --- src/Zcu/PerThread.zig | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/Zcu/PerThread.zig') diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 1074062d55..b353331d95 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -911,6 +911,11 @@ fn createFileRootStruct( try pt.scanNamespace(namespace_index, decls); try zcu.comp.queueJob(.{ .resolve_type_fully = wip_ty.index }); + codegen_type: { + if (zcu.comp.config.use_llvm) break :codegen_type; + if (file.mod.strip) break :codegen_type; + try zcu.comp.queueJob(.{ .codegen_type = wip_ty.index }); + } zcu.setFileRootType(file_index, wip_ty.index); return wip_ty.finish(ip, new_cau_index.toOptional(), namespace_index); } @@ -1332,7 +1337,10 @@ fn semaCau(pt: Zcu.PerThread, cau_index: InternPool.Cau.Index) !SemaCauResult { // to the `codegen_nav` job. try decl_ty.resolveFully(pt); - if (!decl_ty.isFnOrHasRuntimeBits(pt)) break :queue_codegen; + if (!decl_ty.isFnOrHasRuntimeBits(pt)) { + if (zcu.comp.config.use_llvm) break :queue_codegen; + if (file.mod.strip) break :queue_codegen; + } try zcu.comp.queueJob(.{ .codegen_nav = nav_index }); } @@ -2588,6 +2596,22 @@ pub fn linkerUpdateNav(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) !void } } +pub fn linkerUpdateContainerType(pt: Zcu.PerThread, ty: InternPool.Index) !void { + const zcu = pt.zcu; + const comp = zcu.comp; + const ip = &zcu.intern_pool; + + const codegen_prog_node = zcu.codegen_prog_node.start(Type.fromInterned(ty).containerTypeName(ip).toSlice(ip), 0); + defer codegen_prog_node.end(); + + if (comp.bin_file) |lf| { + lf.updateContainerType(pt, ty) catch |err| switch (err) { + error.OutOfMemory => return error.OutOfMemory, + else => |e| log.err("codegen type failed: {s}", .{@errorName(e)}), + }; + } +} + pub fn reportRetryableAstGenError( pt: Zcu.PerThread, src: Zcu.AstGenSrc, -- cgit v1.2.3