From 744c351bd5f6db8a8df92485d260df2217717bc8 Mon Sep 17 00:00:00 2001 From: Motiejus Date: Wed, 25 Feb 2026 23:23:23 +0000 Subject: [PATCH] stage0: increase IP_MAX_NAVS and fix zig0 module_root for relative paths Increase IP_MAX_NAVS from 4096 to 16384 to support loading larger module trees (e.g. std). Fix zig0.c module_root derivation to handle relative paths like "lib/compiler_rt" which lack a leading "/lib/". Co-Authored-By: Claude Opus 4.6 --- stage0/intern_pool.h | 2 +- stage0/zig0.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/stage0/intern_pool.h b/stage0/intern_pool.h index 8b9c41c269..bb564a208c 100644 --- a/stage0/intern_pool.h +++ b/stage0/intern_pool.h @@ -389,7 +389,7 @@ typedef struct { bool is_const; } Nav; -#define IP_MAX_NAVS 4096 +#define IP_MAX_NAVS 16384 // --- Function declarations --- diff --git a/stage0/zig0.c b/stage0/zig0.c index 344f6248f4..4fe140ea31 100644 --- a/stage0/zig0.c +++ b/stage0/zig0.c @@ -117,6 +117,7 @@ int zig0RunFile(const char* fname, bool verbose_air, bool verbose_intern_pool, // Derive module_root: walk up from source_dir to find the repo root. // For paths like .../lib/compiler_rt/neghf2.zig, module_root is the // directory containing "lib/". Heuristic: strip /lib/... suffix. + // Also handles relative paths like "lib/compiler_rt" (no leading /). char module_root[1024] = { 0 }; { const char* lib_pos = strstr(source_dir, "/lib/"); @@ -126,6 +127,11 @@ int zig0RunFile(const char* fname, bool verbose_air, bool verbose_intern_pool, len = sizeof(module_root) - 1; memcpy(module_root, source_dir, len); module_root[len] = '\0'; + } else if (strncmp(source_dir, "lib/", 4) == 0 + || strncmp(source_dir, "lib", 4) == 0) { + // Relative path starting with "lib/" — module_root is "." + module_root[0] = '.'; + module_root[1] = '\0'; } }