selfhost: migrate tool sources to directory packages

Build w6a and w6l from package-main directories and expose the wcc backend through a narrow package API so w6c and wwdump no longer import implementation files. Retarget the remaining load-bearing fixtures and example sources to directory packages; retain the one intentional flat compiler collision as an explicitly composed raw unit.
This commit is contained in:
2026-08-12 17:12:03 +09:00
parent 90f9d60291
commit c7d9dc92de
38 changed files with 197 additions and 252 deletions

View File

@@ -57,9 +57,8 @@ slurp(const char *path, char **outbuf, size_t *outlen)
* the linkable unit is now the per-package .o + reverse-topo .a set the
* sep driver assembles (a raw `w6l <root>.o *.a libwwrt.a` from the test
* side fails — `undefined reference` — because it can't reproduce the
* driver's topo order). The tools are legacy inline-package directories,
* so their explicit main.ww files remain the compatibility roots. Drive
* the full sep build twice; both compile directly and differ only in the
* driver's topo order). Drive each real directory package through the
* full sep build twice; both compile directly and differ only in the
* linker: once with the default C w6l, once with WW_W6L=w6l_ww. Diff
* the two real tool binaries. Exercises the full archive two-pass loader
* + reverse-topo .a resolution — a stronger link than the old single
@@ -77,7 +76,7 @@ build_and_diff(const char *bin, const char *cwd, const char *tool, int id)
snprintf(cmd, sizeof cmd,
"timeout 300 %s/ww build -o %s "
"%s/selfhost/cmd/%s/main.ww >/dev/null 2>&1",
"%s/selfhost/cmd/%s >/dev/null 2>&1",
bin, cstem, cwd, tool);
if (runwait(cmd) != 0) {
fprintf(stderr, "w6l_ww FAIL: C-link sep-build of %s\n", tool);
@@ -86,7 +85,7 @@ build_and_diff(const char *bin, const char *cwd, const char *tool, int id)
}
snprintf(cmd, sizeof cmd,
"WW_W6L=%s/w6l_ww timeout 300 %s/ww build "
"-o %s %s/selfhost/cmd/%s/main.ww >/dev/null 2>&1",
"-o %s %s/selfhost/cmd/%s >/dev/null 2>&1",
bin, bin, wstem, cwd, tool);
if (runwait(cmd) != 0) {
fprintf(stderr, "w6l_ww FAIL: ww-link sep-build of %s\n", tool);