authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-09-22 12:11:45+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-09-22 12:14:26+01:00
logf975e8daa5033bdc4f10a4d1f5fb9a852453c64b
tree22167cd33cb1b0798c7f43f62125e8845585d262
parentb844605c524b9d7fe7327d7b95463ce70ed6fbf4
signature Commit is signed but in an unrecognized format.

Dwarf2: don't assume builtin modules exist

The compiler frontend does not create "builtin" modules unless it sees an import of them during module assignment.

1 files changed, 3 insertions(+), 6 deletions(-)

src/link/Dwarf2.zig+3-6
...@@ -1855,12 +1855,9 @@ pub fn genDebugInfoHeader(...@@ -1855,12 +1855,9 @@ pub fn genDebugInfoHeader(
1855 try dwarf.abbrevCode(dih_nw, .module);1855 try dwarf.abbrevCode(dih_nw, .module);
1856 try dwarf.strx(dih_nw, mod.fully_qualified_name);1856 try dwarf.strx(dih_nw, mod.fully_qualified_name);
1857 try dih_w.writeUleb128(0);1857 try dih_w.writeUleb128(0);
1858 try dwarf.genModuleDependency(1858 if (zcu.builtin_modules.get(mod.getBuiltinOptions(comp.config).hash())) |builtin_mod| {
1859 dih_nw,1859 try dwarf.genModuleDependency(dih_nw, "builtin", builtin_mod, module_offset);
1860 "builtin",1860 }
1861 zcu.builtin_modules.get(mod.getBuiltinOptions(comp.config).hash()).?,
1862 module_offset,
1863 );
1864 try dwarf.genModuleDependency(dih_nw, "root", zcu.root_mod, module_offset);1861 try dwarf.genModuleDependency(dih_nw, "root", zcu.root_mod, module_offset);
1865 try dwarf.genModuleDependency(dih_nw, "std", zcu.std_mod, module_offset);1862 try dwarf.genModuleDependency(dih_nw, "std", zcu.std_mod, module_offset);
1866 for (mod.deps.keys(), mod.deps.values()) |name, dep|1863 for (mod.deps.keys(), mod.deps.values()) |name, dep|