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 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 23:23:23 +00:00
parent 9ae9aff807
commit 744c351bd5
2 changed files with 7 additions and 1 deletions

View File

@@ -389,7 +389,7 @@ typedef struct {
bool is_const;
} Nav;
#define IP_MAX_NAVS 4096
#define IP_MAX_NAVS 16384
// --- Function declarations ---

View File

@@ -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';
}
}