boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

commit 20bdc9d3b540ec050be7201600f9a67a18174cc8
parent 203b4b271024e403cd997d2bec21a0ce6c26b5db
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Wed,  6 May 2026 13:22:34 -0700

TU: tests consume bootN outputs directly

Drop the parallel test-side build tree (build/<a>/{tools,M1pp,hex2pp,
scheme1,cc,vendor,tcc-boot2,tcc-tcc,tcc-tcc-tcc,tcc-libc/{mem,libc}.o})
and point every test dependency at the bootN chain it duplicates.

Promote outputs missed by the bootN graph:
  - boot3 exports libc.P1pp + tcc.flat.P1pp (already produced inside,
    only tcc0 was previously kept).
  - boot4 keeps tcc1 / tcc2 (stage-2 / stage-3 self-built tcc used by
    the tcc-cc / tcc-libc suites).
  - top-level build/cc.scm = cat prelude+cc+main, arch-independent.

tests/Makefile: TEST_*_DEPS macros now resolve to build/<a>/podman/
boot{N}/... or build/cc.scm. Per-arch tcc-cc/tcc-libc start.S /
sys_stubs.S / va_list stubs stay (no bootN equivalent); their assembler
dep retargeted from tcc-boot2 to boot3/tcc0. Aggregate goes from 410 →
280 lines.

tests/run-suite.sh, tests/build-{p1,p1pp,cc}.sh, scripts/boot-run-
scheme1.sh: every hard-coded path swapped to its bootN equivalent.

Top-level Makefile drops the native-tools dev-loop helpers (and
.PHONY churn that came with them); scripts/build-native-tools.sh goes
with them. scripts/boot.sh gains a --help banner.

Diffstat:
MMakefile | 56++++++++++++++++++++++++--------------------------------
Mscripts/boot-run-scheme1.sh | 20+++++++++++---------
Mscripts/boot.sh | 31+++++++++++++++++++++++++++++++
Mscripts/boot3.sh | 13++++++++++---
Mscripts/boot4.sh | 9++++++---
Dscripts/build-native-tools.sh | 85-------------------------------------------------------------------------------
Mtests/Makefile | 267++++++++++++++++++++++---------------------------------------------------------
Mtests/build-cc.sh | 4++--
Mtests/build-p1.sh | 11++++++-----
Mtests/build-p1pp.sh | 14+++++++-------
Mtests/run-suite.sh | 60++++++++++++++++++++++++++++++------------------------------
11 files changed, 202 insertions(+), 368 deletions(-)

diff --git a/Makefile b/Makefile @@ -60,16 +60,19 @@ OUT_DIR := build/$(ARCH)/$(DRIVER) .SUFFIXES: -.PHONY: all help clean image cloc test tools tools-native tables \ - audit prep-src prep-musl +.PHONY: all help clean cloc src # ── Top-level targets ──────────────────────────────────────────────────── all: build/$(ARCH)/$(DRIVER)/boot6/$(KERNEL_NAME_$(ARCH)) +# Prepare the canonical source tree (prep-src + prep-musl) for ARCH. +src: build/$(ARCH)/src/musl/.stamp + help: @echo 'Targets (default ARCH=$(ARCH) DRIVER=$(DRIVER)):' @echo ' make all build boot6 kernel' + @echo ' make src prep canonical src/ tree (incl. musl)' @echo ' make build/<arch>/<driver>/boot6/<kn> full chain (kn = Image | kernel.elf)' @echo ' make build/<arch>/<driver>/bootN/<file> any single artifact' @echo ' make test SUITE=<suite> test suite (NAMES=<filter> optional)' @@ -143,7 +146,7 @@ build/$1/src/musl/.stamp: build/$1/src/.stamp \ scripts/prep-musl.sh scripts/lib-arch.sh \ $$(wildcard vendor/upstream/musl-1.2.5-skip-$1.txt) scripts/prep-musl.sh $1 - @touch $$@ + @mkdir -p $$(@D) && touch $$@ endef $(foreach a,$(ALL_ARCHES),$(eval $(call PREP_RULES,$a))) @@ -198,7 +201,8 @@ build/$1/$2/boot3/.stamp: \ DRIVER=$2 scripts/boot3.sh $1 @touch $$@ -build/$1/$2/boot3/tcc0: build/$1/$2/boot3/.stamp ; +build/$1/$2/boot3/tcc0 build/$1/$2/boot3/libc.P1pp \ +build/$1/$2/boot3/tcc.flat.P1pp: build/$1/$2/boot3/.stamp ; # boot4: tcc0 -> tcc1 -> tcc2 -> tcc3 self-host chain (+ libc.a, libtcc1.a, hello) build/$1/$2/boot4/.stamp: \ @@ -209,6 +213,7 @@ build/$1/$2/boot4/.stamp: \ DRIVER=$2 scripts/boot4.sh $1 @touch $$@ +build/$1/$2/boot4/tcc1 build/$1/$2/boot4/tcc2 \ build/$1/$2/boot4/tcc3 build/$1/$2/boot4/hello \ build/$1/$2/boot4/crt1.o build/$1/$2/boot4/libc.a \ build/$1/$2/boot4/libtcc1.a: build/$1/$2/boot4/.stamp ; @@ -241,9 +246,16 @@ endef $(foreach a,$(ALL_ARCHES),$(foreach d,$(ALL_DRIVERS),$(eval $(call BOOT_CHAIN_RULES,$a,$d)))) -# Phony aliases for the active ARCH × DRIVER pair, useful for scripting. -prep-src: build/$(ARCH)/src/.stamp -prep-musl: build/$(ARCH)/src/musl/.stamp +# ── Top-level catm'd cc bundle (arch-independent) ──────────────────────── +# +# scheme1 reads cc as one file: prelude + cc + main concatenated. The +# output is arch-independent, so we keep a single repo-level copy that +# every test invocation reuses regardless of arch. Plain `cat` is byte- +# equivalent to running the bootN catm on these inputs. + +build/cc.scm: scheme1/prelude.scm cc/cc.scm cc/main.scm + mkdir -p $(@D) + cat $^ > $@ # ── cloc ───────────────────────────────────────────────────────────────── # @@ -274,31 +286,11 @@ CLOC_FILES := \ cloc: @sh scripts/count-lines.sh $(CLOC_FILES) -# ── Native tools (opt-in dev-loop helpers) ─────────────────────────────── - -NATIVE_TOOLS := build/native-tools/M1 build/native-tools/hex2 \ - build/native-tools/m1pp build/native-tools/hex2pp - -tools-native: $(NATIVE_TOOLS) - -build/native-tools/M1: scripts/build-native-tools.sh - sh scripts/build-native-tools.sh M1 - -build/native-tools/hex2: scripts/build-native-tools.sh - sh scripts/build-native-tools.sh hex2 - -build/native-tools/m1pp: scripts/build-native-tools.sh M1pp/M1pp.c - sh scripts/build-native-tools.sh m1pp - -build/native-tools/hex2pp: scripts/build-native-tools.sh hex2pp/hex2pp.c - sh scripts/build-native-tools.sh hex2pp - # ── Test infrastructure (suites + their build deps) ────────────────────── -# tests/Makefile owns the legacy test-build rules (M1pp/hex2pp/scheme1/cc -# self-hosted binaries, mes-libc, tcc-boot2, tcc-tcc/tcc-tcc-tcc) and the -# `test` / `image` / `tools` / `tables` targets. ARCH/DRIVER and per-arch -# metadata above are visible to the include. REPO_ROOT signals to -# tests/Makefile that it is being included from the top-level (rather -# than invoked standalone via `make -C tests`). +# tests/Makefile owns the test-build rules and the `test` / `image` / +# `tables` targets. ARCH/DRIVER and per-arch metadata above are visible +# to the include. REPO_ROOT signals to tests/Makefile that it is being +# included from the top-level (rather than invoked standalone via +# `make -C tests`). REPO_ROOT := $(CURDIR) include tests/Makefile diff --git a/scripts/boot-run-scheme1.sh b/scripts/boot-run-scheme1.sh @@ -1,12 +1,13 @@ #!/bin/sh -## boot-run-scheme1.sh — in-container wrapper that runs the scheme1 -## binary on USER_SRC with scheme1/prelude.scm catm'd in front. Caller -## (Make / the test runner) ensures build/$ARCH/scheme1/scheme1 and -## build/$ARCH/tools/catm and scheme1/prelude.scm exist before invoking. +## boot-run-scheme1.sh — in-container wrapper that runs the boot2 +## scheme1 binary on USER_SRC with scheme1/prelude.scm catm'd in front. +## Caller (Make / the test runner) ensures build/$ARCH/podman/boot2/ +## scheme1, build/$ARCH/podman/boot2/catm and scheme1/prelude.scm exist +## before invoking. ## ## Pipeline: -## catm /tmp/combined.scm scheme1/prelude.scm <user_src> -## build/$ARCH/scheme1/scheme1 /tmp/combined.scm +## catm /tmp/combined.scm scheme1/prelude.scm <user_src> +## scheme1 /tmp/combined.scm ## ## Env: ARCH=aarch64|amd64|riscv64 ## Usage: boot-run-scheme1.sh <user_src> @@ -17,10 +18,11 @@ set -eu [ "$#" -eq 1 ] || { echo "usage: ARCH=<arch> $0 <user_src>" >&2; exit 2; } USER_SRC=$1 -TOOLS=build/$ARCH/tools -SCHEME1=build/$ARCH/scheme1/scheme1 +BOOT2=build/$ARCH/podman/boot2 +SCHEME1=$BOOT2/scheme1 +CATM=$BOOT2/catm PRELUDE=scheme1/prelude.scm COMBINED=/tmp/scheme1-combined.scm -"$TOOLS/catm" "$COMBINED" "$PRELUDE" "$USER_SRC" +"$CATM" "$COMBINED" "$PRELUDE" "$USER_SRC" exec "$SCHEME1" "$COMBINED" diff --git a/scripts/boot.sh b/scripts/boot.sh @@ -16,6 +16,37 @@ set -e +case "${1:-}" in + -h|--help) + cat <<'EOF' +boot.sh — drive boot0 → boot6 end-to-end under one driver. + +Usage: + scripts/boot.sh <aarch64|amd64|riscv64> + +Environment variables (all optional): + DRIVER podman (default) | seed. + podman: containerised builds. + seed: builds run inside the tcc-built + seed kernel under qemu (requires + one prior DRIVER=podman pass to + mint build/$ARCH/podman/boot6/). + BOOT3_TIMEOUT (default 1800) boot3 (scheme1) wall-clock seconds. + BOOT4_TIMEOUT (default 5400) boot4 (tcc1/2/3) wall-clock seconds. + BOOT5_TIMEOUT (default 7200) boot5 (musl) wall-clock seconds. + BOOT6_TIMEOUT (default 1200) boot6 (kernel) wall-clock seconds. + QEMU_MEM (default 3072M) guest RAM passed to the seed-driver qemu. + TCC_BOOTSTRAP_RELAX_FIXEDPOINT set to 1 in boot4 to accept tcc2 != tcc3. + After a codegen-altering tcc patch the + two-stage rule needs a third bounce to + converge; the next boot4 run, started + from this run's tcc3, will reach + tcc2 == tcc3 with no extra knob. +EOF + exit 0 + ;; +esac + . scripts/lib-arch.sh bootlib_init boot "${1:-}" diff --git a/scripts/boot3.sh b/scripts/boot3.sh @@ -36,8 +36,13 @@ ## asm step is required. ## ## ─── Outputs ────────────────────────────────────────────────────────── -## build/$ARCH/$DRIVER/boot3/tcc0 — cc.scm-built bootstrap tcc, consumed -## by scripts/boot4.sh +## build/$ARCH/$DRIVER/boot3/tcc0 — cc.scm-built bootstrap tcc, +## consumed by scripts/boot4.sh +## build/$ARCH/$DRIVER/boot3/libc.P1pp — cc.scm-built mes-libc (lib mode); +## consumed by the cc-libc test suite +## build/$ARCH/$DRIVER/boot3/tcc.flat.P1pp — cc.scm-built tcc TU (lib mode); +## retained as a debug/inspection +## artifact ## ## Usage: scripts/boot3.sh <arch> ## <arch> ∈ {aarch64, amd64, riscv64} for either DRIVER (default podman). @@ -87,7 +92,9 @@ runscm_input_from_src src tcc/tcc.flat.c runscm_input_from_src src libc/libc.flat.c runscm_export tcc0 +runscm_export libc.P1pp +runscm_export tcc.flat.P1pp runscm_run "${BOOT3_TIMEOUT:-1800}" -echo "[$BOOT_TAG] sizes: tcc0=$(wc -c <"$OUT/tcc0")" +echo "[$BOOT_TAG] sizes: tcc0=$(wc -c <"$OUT/tcc0") libc.P1pp=$(wc -c <"$OUT/libc.P1pp")" echo "[$BOOT_TAG] OK -> $OUT/tcc0" diff --git a/scripts/boot4.sh b/scripts/boot4.sh @@ -53,6 +53,8 @@ ## tcc-0.9.26 (see docs/TCC-ARM64-ASM.md). ## ## ─── Outputs ────────────────────────────────────────────────────────── +## build/$ARCH/$DRIVER/boot4/tcc1 — tcc0-built tcc (stage-2 in tests) +## build/$ARCH/$DRIVER/boot4/tcc2 — tcc1-built tcc (stage-3 in tests) ## build/$ARCH/$DRIVER/boot4/tcc3 — final fixed-point self-host tcc ## build/$ARCH/$DRIVER/boot4/crt1.o ## — tcc2-built startup object, kept outside @@ -152,12 +154,13 @@ if ! cmp -s "$OUT/tcc2" "$OUT/tcc3"; then fi fi -# ── normalize output names (drop s3- prefix; remove intermediate tccN) ─ +# ── normalize output names (drop s3- prefix) ────────────────────────── +# tcc1 / tcc2 are kept on disk: the test path (tcc-cc / tcc-libc suites) +# uses them as stage-2 / stage-3 self-built tcc binaries. mv "$OUT/s3-crt1.o" "$OUT/crt1.o" mv "$OUT/s3-libc.a" "$OUT/libc.a" mv "$OUT/s3-libtcc1.a" "$OUT/libtcc1.a" -rm -f "$OUT/tcc1" "$OUT/tcc2" -chmod 0700 "$OUT/tcc3" "$OUT/hello" +chmod 0700 "$OUT/tcc1" "$OUT/tcc2" "$OUT/tcc3" "$OUT/hello" echo "[$BOOT_TAG] sizes: libtcc1.a=$(wc -c <"$OUT/libtcc1.a") libc.a=$(wc -c <"$OUT/libc.a") hello=$(wc -c <"$OUT/hello")" echo "[$BOOT_TAG] OK -> $OUT/{tcc3, crt1.o, libc.a, libtcc1.a, hello} (fixed point: tcc2 == tcc3)" diff --git a/scripts/build-native-tools.sh b/scripts/build-native-tools.sh @@ -1,85 +0,0 @@ -#!/bin/sh -## build-native-tools.sh — host-compile one of the dev-loop tools. -## -## Pure transformation invoked by the Makefile per-target. Always rebuilds -## the requested tool; Make handles staleness. -## -## Tools (NOT in the bootstrap chain — fast host substitutes): -## M1, hex2 — built from upstream mescc-tools sources (legacy oracle) -## m1pp — built from M1pp/M1pp.c (the C oracle for the new M1pp) -## hex2pp — built from hex2pp/hex2pp.c (the C oracle for hex2++) -## -## Source lookup for M1/hex2 (first match wins): -## 1. $MESCC_TOOLS_SRC (direct override) -## 2. $LIVE_BOOTSTRAP/seed/stage0-posix/mescc-tools -## -## No in-tree vendor copy — these tools are dev-loop helpers (the -## bootstrap path uses our seed/stage0 hex builds), so we keep the -## external dep explicit. Set LIVE_BOOTSTRAP=<path> the same way -## scripts/diag-livebootstrap-qemu.sh does. -## -## Usage: scripts/build-native-tools.sh <M1|hex2|m1pp|hex2pp> - -set -eu - -[ "$#" -eq 1 ] || { echo "usage: $0 <M1|hex2|m1pp|hex2pp>" >&2; exit 2; } - -TOOL=$1 -REPO=$(cd "$(dirname "$0")/.." && pwd) -cd "$REPO" - -OUT=build/native-tools -mkdir -p "$OUT" - -: "${CC:=cc}" -CFLAGS="-O2 -std=c99 -D_GNU_SOURCE" - -find_mescc_src() { - if [ -n "${MESCC_TOOLS_SRC:-}" ]; then - if [ -f "$MESCC_TOOLS_SRC/M1-macro.c" ] && [ -f "$MESCC_TOOLS_SRC/M2libc/bootstrappable.c" ]; then - echo "$MESCC_TOOLS_SRC" - return 0 - fi - echo "build-native-tools.sh: MESCC_TOOLS_SRC=$MESCC_TOOLS_SRC is not a complete mescc-tools tree" >&2 - return 1 - fi - if [ -n "${LIVE_BOOTSTRAP:-}" ]; then - d=$LIVE_BOOTSTRAP/seed/stage0-posix/mescc-tools - if [ -f "$d/M1-macro.c" ] && [ -f "$d/M2libc/bootstrappable.c" ]; then - echo "$d" - return 0 - fi - echo "build-native-tools.sh: LIVE_BOOTSTRAP=$LIVE_BOOTSTRAP has no mescc-tools at $d" >&2 - return 1 - fi - echo "build-native-tools.sh: no mescc-tools source found." >&2 - echo " set MESCC_TOOLS_SRC=<dir-with-M1-macro.c-and-M2libc/>," >&2 - echo " or LIVE_BOOTSTRAP=<live-bootstrap-checkout>," >&2 - echo " or fall back to the bootstrap path with M1PP_BOOTSTRAP_TOOLS=1." >&2 - return 1 -} - -case "$TOOL" in - M1) - SRC=$(find_mescc_src) - $CC $CFLAGS \ - "$SRC/M1-macro.c" "$SRC/stringify.c" "$SRC/M2libc/bootstrappable.c" \ - -o "$OUT/M1" - ;; - hex2) - SRC=$(find_mescc_src) - $CC $CFLAGS \ - "$SRC/hex2.c" "$SRC/hex2_linker.c" "$SRC/hex2_word.c" "$SRC/M2libc/bootstrappable.c" \ - -o "$OUT/hex2" - ;; - m1pp) - $CC -O2 -std=c99 M1pp/M1pp.c -o "$OUT/m1pp" - ;; - hex2pp) - $CC -O2 -std=c99 hex2pp/hex2pp.c -o "$OUT/hex2pp" - ;; - *) - echo "build-native-tools.sh: unknown tool '$TOOL'" >&2 - exit 2 - ;; -esac diff --git a/tests/Makefile b/tests/Makefile @@ -14,9 +14,9 @@ # test SUITE=tcc-cc ARCH=... self-built tcc through cc fixtures # test SUITE=tcc-libc ARCH=... self-built tcc through cc-libc fixtures # -# Suite-specific build targets (image, tools, M1pp, hex2pp, scheme1, cc, -# tcc-boot2/tcc-tcc/tcc-tcc-tcc, mes-libc) are kept here too so the -# top-level Makefile is bootstrap-only. +# Tests pin DRIVER=podman: every binary tests reach for is the +# bootN-built podman variant. The seed-driver chain is exercised by +# the bootstrap top-level, not the test runner. ifndef REPO_ROOT # ── Standalone invocation: delegate to top-level. ──────────────────────── @@ -29,6 +29,19 @@ $(MAKECMDGOALS): __forward ; else # ── Included from top-level: emit rules. ───────────────────────────────── +# Tests always run against the podman driver's bootN outputs. The seed +# driver builds an equivalent chain but boots through QEMU; that path is +# validated by the top-level bootstrap, not by the test suite. +TEST_DRIVER := podman + +# bootN/<file> path helpers — keep call sites readable. +boot0 = build/$(1)/$(TEST_DRIVER)/boot0 +boot1 = build/$(1)/$(TEST_DRIVER)/boot1 +boot2 = build/$(1)/$(TEST_DRIVER)/boot2 +boot3 = build/$(1)/$(TEST_DRIVER)/boot3 +boot4 = build/$(1)/$(TEST_DRIVER)/boot4 +boot5 = build/$(1)/$(TEST_DRIVER)/boot5 + # ── tests-only container images (boot2-busybox, boot2-alpine-gcc) ──────── IMAGE_STAMP := build/$(ARCH)/.image @@ -62,19 +75,6 @@ ALPINE_GCC = podman run --rm --pull=never --platform $(PLATFORM_$(1)) \ -e ARCH=$(1) \ -v $(CURDIR):/work -w /work boot2-alpine-gcc:$(1) -# ── Stage1 seed tools (M0/catm/hex2-0): vendored hex0-seed in container ── - -build/%/tools/M0 build/%/tools/catm build/%/tools/hex2-0 &: \ - scripts/mk-seed-tools.sh build/%/.image \ - vendor/seed/%/hex0-seed vendor/seed/%/hex0.hex0 \ - vendor/seed/%/hex1.hex0 vendor/seed/%/hex2.hex1 \ - vendor/seed/%/catm.hex2 vendor/seed/%/M0.hex2 \ - vendor/seed/%/ELF.hex2 - $(call PODMAN,$*) sh scripts/mk-seed-tools.sh - -.PHONY: tools -tools: $(foreach a,$(ALL_ARCHES),build/$(a)/tools/M0) - # ── P1 backend tables (committed under P1/P1-<arch>.M1) ────────────────── P1_PRUNE_SRCS := M1pp/M1pp.P1 hex2pp/hex2pp.P1 $(wildcard tests/P1/*.P1) @@ -91,113 +91,32 @@ build/%/P1/P1.M1: $(wildcard P1/gen/*.py) P1/P1-%.M1: build/%/P1/P1.M1 scripts/prune-p1-table.sh $(P1_PRUNE_SRCS) sh scripts/prune-p1-table.sh $< $@ $(P1_PRUNE_SRCS) -# ── Per-arch self-hosted M1pp / hex2pp / scheme1 / cc binaries ─────────── - -M1PP_BINS := $(foreach a,$(ALL_ARCHES),build/$(a)/M1pp/M1pp) -HEX2PP_BINS := $(foreach a,$(ALL_ARCHES),build/$(a)/hex2pp/hex2pp) -SCHEME1_SRC := scheme1/scheme1.P1pp -SCHEME1_BINS := $(foreach a,$(ALL_ARCHES),build/$(a)/scheme1/scheme1) - -CC_SRCS := scheme1/prelude.scm cc/cc.scm cc/main.scm -CC_BINS := $(foreach a,$(ALL_ARCHES),build/$(a)/cc/cc.scm) - -P1_BUILD_DEPS = scripts/lint.sh tests/build-p1.sh \ - build/%/.image build/%/tools/M0 \ - vendor/seed/%/ELF.hex2 P1/P1-%.M1 - -P1PP_BUILD_DEPS = tests/build-p1pp.sh \ - build/%/.image \ - build/%/M1pp/M1pp build/%/hex2pp/hex2pp \ - vendor/seed/%/ELF.hex2 \ - P1/P1-%.M1pp P1/P1.M1pp P1/P1pp.P1pp - -$(M1PP_BINS): build/%/M1pp/M1pp: M1pp/M1pp.P1 $(P1_BUILD_DEPS) - ARCH=$* sh scripts/lint.sh M1pp/M1pp.P1 - $(call PODMAN,$*) sh tests/build-p1.sh M1pp/M1pp.P1 $@ - -$(HEX2PP_BINS): build/%/hex2pp/hex2pp: hex2pp/hex2pp.P1 $(P1_BUILD_DEPS) - ARCH=$* sh scripts/lint.sh hex2pp/hex2pp.P1 - $(call PODMAN,$*) sh tests/build-p1.sh hex2pp/hex2pp.P1 $@ - -$(SCHEME1_BINS): build/%/scheme1/scheme1: $(SCHEME1_SRC) $(P1PP_BUILD_DEPS) - $(call PODMAN,$*) sh tests/build-p1pp.sh $@ $(SCHEME1_SRC) - -$(CC_BINS): build/%/cc/cc.scm: $(CC_SRCS) build/%/.image build/%/tools/catm - mkdir -p $(@D) - $(call PODMAN,$*) build/$*/tools/catm $@ $(CC_SRCS) - -# ── tcc-boot2 chain (cc.scm-built tcc + mes-libc, tests-only) ──────────── - -TCC_TARGET_aarch64 := ARM64 -TCC_TARGET_amd64 := X86_64 -TCC_TARGET_riscv64 := RISCV64 -TCC_TARGET ?= $(TCC_TARGET_$(ARCH)) -TCC_VENDOR := build/$(ARCH)/vendor/tcc -TCC_FLAT := $(TCC_VENDOR)/tcc.flat.c -TCC_FLATS := $(foreach a,$(ALL_ARCHES),build/$(a)/vendor/tcc/tcc.flat.c) - -TCC_BOOT2_BINS := $(foreach a,$(ALL_ARCHES),build/$(a)/tcc-boot2/tcc-boot2) -TCC_BOOT2_P1PPS := $(foreach a,$(ALL_ARCHES),build/$(a)/tcc-boot2/tcc.flat.P1pp) - -LIBC_FLATS := $(foreach a,$(ALL_ARCHES),build/$(a)/vendor/mes-libc/libc.flat.c) -LIBC_P1PPS := $(foreach a,$(ALL_ARCHES),build/$(a)/vendor/mes-libc/libc.P1pp) - -$(TCC_FLATS): build/%/vendor/tcc/tcc.flat.c: scripts/stage1-flatten.sh - sh scripts/stage1-flatten.sh --arch $* - -build/%/vendor/tcc/stdarg-bridge.h: build/%/vendor/tcc/tcc.flat.c - -LIBC_VENDOR_SRCS := $(shell find vendor/mes-libc -type f \( -name '*.c' -o -name '*.h' \) 2>/dev/null) \ - $(wildcard vendor/mes-libc/patches/*.before) \ - $(wildcard vendor/mes-libc/patches/*.after) - -$(LIBC_FLATS): build/%/vendor/mes-libc/libc.flat.c: \ - scripts/libc-flatten.sh build/%/vendor/tcc/stdarg-bridge.h $(LIBC_VENDOR_SRCS) - sh scripts/libc-flatten.sh --arch $* - -CC_DEBUG ?= 0 -CC_TRACE_EMIT ?= 0 - -$(LIBC_P1PPS): build/%/vendor/mes-libc/libc.P1pp: \ - build/%/vendor/mes-libc/libc.flat.c \ - build/%/scheme1/scheme1 build/%/cc/cc.scm \ - tests/build-cc.sh build/%/.image - $(call PODMAN,$*) env CC_LIB=libc__ \ - CC_DEBUG=$(CC_DEBUG) CC_TRACE_EMIT=$(CC_TRACE_EMIT) \ - sh tests/build-cc.sh $< $@ - -$(TCC_BOOT2_P1PPS): build/%/tcc-boot2/tcc.flat.P1pp: \ - build/%/vendor/tcc/tcc.flat.c build/%/scheme1/scheme1 build/%/cc/cc.scm \ - tests/build-cc.sh build/%/.image - $(call PODMAN,$*) env CC_LIB=tcc__ \ - CC_DEBUG=$(CC_DEBUG) CC_TRACE_EMIT=$(CC_TRACE_EMIT) \ - sh tests/build-cc.sh build/$*/vendor/tcc/tcc.flat.c $@ - -$(TCC_BOOT2_BINS): build/%/tcc-boot2/tcc-boot2: \ - build/%/tcc-boot2/tcc.flat.P1pp build/%/vendor/mes-libc/libc.P1pp \ - P1/entry-libc.P1pp P1/elf-end.P1pp \ - $(P1PP_BUILD_DEPS) - $(call PODMAN,$*) env WORK_SUBPATH=tcc-boot2/tcc-boot2 \ - sh tests/build-p1pp.sh $@ \ - P1/entry-libc.P1pp build/$*/vendor/mes-libc/libc.P1pp \ - $< P1/elf-end.P1pp - # ── tcc-gcc: same flatten, stock gcc (sanity check) ────────────────────── +TCC_PKG_INCLUDE = build/$(ARCH)/src/src/tcc/$(TCC_PKG)/include +TCC_PKG_LIBDIR = build/$(ARCH)/src/src/tcc/$(TCC_PKG)/lib + TCC_GCC_BIN := build/$(ARCH)/tcc-gcc/tcc-gcc TCC_GCC_IMAGE := build/$(ARCH)/.image-alpine-gcc TCC_GCC_HARNESS := tcc-gcc/$(ARCH)/start.S tcc-gcc/$(ARCH)/sys_stubs.c +TCC_GCC_TCC_FLAT := build/$(ARCH)/src/src/tcc/tcc.flat.c +TCC_GCC_LIBC_FLAT := build/$(ARCH)/src/src/libc/libc.flat.c -$(TCC_GCC_BIN): $(TCC_FLAT) build/$(ARCH)/vendor/mes-libc/libc.flat.c \ - $(TCC_GCC_HARNESS) scripts/build-tcc-gcc.sh $(TCC_GCC_IMAGE) +$(TCC_GCC_BIN): $(TCC_GCC_TCC_FLAT) $(TCC_GCC_LIBC_FLAT) \ + $(TCC_GCC_HARNESS) scripts/build-tcc-gcc.sh $(TCC_GCC_IMAGE) \ + build/$(ARCH)/src/.stamp mkdir -p $(@D) podman run --rm --pull=never --platform $(PLATFORM_$(ARCH)) \ -e ARCH=$(ARCH) \ -v $(CURDIR):/work -w /work boot2-alpine-gcc:$(ARCH) \ - sh scripts/build-tcc-gcc.sh $@ $(TCC_FLAT) \ - build/$(ARCH)/vendor/mes-libc/libc.flat.c + sh scripts/build-tcc-gcc.sh $@ $(TCC_GCC_TCC_FLAT) $(TCC_GCC_LIBC_FLAT) -# ── tcc-cc / tcc-libc / tcc-tcc / tcc-tcc-tcc test infrastructure ──────── +# ── tcc-cc / tcc-libc test stubs (per-arch start.S / sys_stubs.S) ──────── +# +# Tests pull every other tcc-flow binary out of bootN now (tcc0 from +# boot3, tcc1/tcc2 from boot4, libc.a/libtcc1.a from boot4/boot5). The +# tcc-cc and tcc-libc trees keep a few small per-arch stubs that the +# bootN chain doesn't expose as standalone .o files. HOST_CC ?= cc @@ -207,9 +126,14 @@ HOST_CC_TARGET_aarch64 := aarch64-linux-gnu HOST_CC_TARGET_amd64 := x86_64-linux-gnu HOST_CC_TARGET = $(HOST_CC_TARGET_$(ARCH)) +# Assembler used to compile per-arch .S stubs into .o: +# aarch64 — boot3/tcc0 inside the busybox container (it speaks AArch64 +# asm thanks to the phase-1 arm64 patches). +# riscv64 — alpine-gcc (boot3/tcc0 lacks RISC-V inline asm support). +# amd64 — host clang/cc with a Linux target triple. ifeq ($(ARCH),aarch64) -TCC_ASM_DEPS := build/$(ARCH)/tcc-boot2/tcc-boot2 build/$(ARCH)/.image -TCC_ASM = $(call PODMAN,$(ARCH)) build/$(ARCH)/tcc-boot2/tcc-boot2 -nostdlib -c -o $(1) $(2) +TCC_ASM_DEPS := $(call boot3,$(ARCH))/tcc0 build/$(ARCH)/.image +TCC_ASM = $(call PODMAN,$(ARCH)) $(call boot3,$(ARCH))/tcc0 -nostdlib -c -o $(1) $(2) else ifeq ($(ARCH),riscv64) TCC_ASM_DEPS := build/$(ARCH)/.image-alpine-gcc TCC_ASM = $(call ALPINE_GCC,$(ARCH)) cc -c -o $(1) -x assembler $(2) @@ -219,46 +143,32 @@ TCC_ASM = $(HOST_CC) -target $(HOST_CC_TARGET) -c -o $(1) -x assembler $(2 endif TCC_CC_START := build/$(ARCH)/tcc-cc/start.o -TCC_CC_MEM := build/$(ARCH)/tcc-cc/mem.o -TCC_CC_TCC_INCLUDE = $(TCC_VENDOR)/$(TCC_PKG)/include -TCC_CC_TCC_LIBDIR = $(TCC_VENDOR)/$(TCC_PKG)/lib ifeq ($(ARCH),amd64) +# x86_64 va_arg intrinsics (__va_start / __va_arg). On other arches tcc +# lowers va_arg without out-of-line helpers. TCC_CC_VA_LIST := build/$(ARCH)/tcc-cc/va_list.o else TCC_CC_VA_LIST := endif -TCC_LIBC_DIR := build/$(ARCH)/tcc-libc -TCC_LIBC_START := $(TCC_LIBC_DIR)/start.o -TCC_LIBC_SYS_STUBS := $(TCC_LIBC_DIR)/sys_stubs.o -TCC_LIBC_MEM := $(TCC_LIBC_DIR)/mem.o -TCC_LIBC_LIBC := $(TCC_LIBC_DIR)/libc.o - -TCC_TCC_BIN := build/$(ARCH)/tcc-tcc/tcc-tcc -TCC_TCC_TCC_BIN := build/$(ARCH)/tcc-tcc-tcc/tcc-tcc-tcc +TCC_LIBC_START := build/$(ARCH)/tcc-libc/start.o +TCC_LIBC_SYS_STUBS := build/$(ARCH)/tcc-libc/sys_stubs.o $(TCC_CC_START): tcc-cc/$(ARCH)/start.S $(TCC_ASM_DEPS) mkdir -p $(@D) $(call TCC_ASM,$@,$<) -$(TCC_CC_MEM): tcc-cc/mem.c \ - build/$(ARCH)/tcc-boot2/tcc-boot2 \ - build/$(ARCH)/.image - mkdir -p $(@D) - $(call PODMAN,$(ARCH)) \ - build/$(ARCH)/tcc-boot2/tcc-boot2 \ - -nostdlib -I $(TCC_CC_TCC_INCLUDE) -c -o $@ $< - build/amd64/tcc-cc/va_list.o: \ - build/amd64/tcc-boot2/tcc-boot2 \ - build/amd64/.image build/amd64/vendor/tcc/tcc.flat.c + build/amd64/src/src/tcc/$(TCC_PKG)/lib/va_list.c \ + $(call boot3,amd64)/tcc0 build/amd64/.image \ + build/amd64/src/.stamp mkdir -p $(@D) $(call PODMAN,amd64) \ - build/amd64/tcc-boot2/tcc-boot2 \ - -nostdlib -I build/amd64/vendor/tcc/$(TCC_PKG)/include \ + $(call boot3,amd64)/tcc0 \ + -nostdlib -I build/amd64/src/src/tcc/$(TCC_PKG)/include \ -D TCC_TARGET_X86_64=1 \ - -c -o $@ build/amd64/vendor/tcc/$(TCC_PKG)/lib/va_list.c + -c -o $@ build/amd64/src/src/tcc/$(TCC_PKG)/lib/va_list.c $(TCC_LIBC_START): tcc-libc/$(ARCH)/start.S $(TCC_ASM_DEPS) mkdir -p $(@D) @@ -268,44 +178,6 @@ $(TCC_LIBC_SYS_STUBS): tcc-libc/$(ARCH)/sys_stubs.S $(TCC_ASM_DEPS) mkdir -p $(@D) $(call TCC_ASM,$@,$<) -$(TCC_LIBC_MEM): tcc-cc/mem.c \ - build/$(ARCH)/tcc-boot2/tcc-boot2 \ - build/$(ARCH)/.image - mkdir -p $(@D) - $(call PODMAN,$(ARCH)) \ - build/$(ARCH)/tcc-boot2/tcc-boot2 \ - -nostdlib -I $(TCC_CC_TCC_INCLUDE) -c -o $@ $< - -$(TCC_LIBC_LIBC): build/$(ARCH)/vendor/mes-libc/libc.flat.c \ - build/$(ARCH)/tcc-boot2/tcc-boot2 \ - build/$(ARCH)/.image - mkdir -p $(@D) - $(call PODMAN,$(ARCH)) \ - build/$(ARCH)/tcc-boot2/tcc-boot2 \ - -nostdlib -I $(TCC_CC_TCC_INCLUDE) \ - -include $(TCC_CC_TCC_INCLUDE)/stdarg.h \ - -c -o $@ $< - -$(TCC_TCC_BIN): scripts/boot-build-tcc-tcc.sh \ - $(TCC_FLAT) \ - build/$(ARCH)/tcc-boot2/tcc-boot2 \ - $(TCC_LIBC_START) $(TCC_LIBC_SYS_STUBS) \ - $(TCC_LIBC_MEM) $(TCC_LIBC_LIBC) \ - build/$(ARCH)/.image - mkdir -p $(@D) - $(call PODMAN,$(ARCH)) \ - sh scripts/boot-build-tcc-tcc.sh $@ - -$(TCC_TCC_TCC_BIN): scripts/boot-build-tcc-tcc.sh \ - $(TCC_FLAT) \ - $(TCC_TCC_BIN) \ - $(TCC_LIBC_START) $(TCC_LIBC_SYS_STUBS) \ - $(TCC_LIBC_MEM) $(TCC_LIBC_LIBC) \ - build/$(ARCH)/.image - mkdir -p $(@D) - $(call PODMAN,$(ARCH)) \ - sh scripts/boot-build-tcc-tcc.sh $@ $(TCC_TCC_BIN) - # ── Suite dispatch (proxies to tests/run.sh) ───────────────────────────── SUITE ?= @@ -318,38 +190,49 @@ else TEST_ARCHES := $(ARCH) endif +# Per-suite build dependency sets. Every entry resolves to a bootN +# artifact (or, for `start.o` / `sys_stubs.o` / `va_list.o`, a small +# per-arch .S stub built next to bootN binaries). + TEST_M1PP_DEPS := $(foreach a,$(TEST_ARCHES), \ - build/$(a)/.image build/$(a)/M1pp/M1pp build/$(a)/hex2pp/hex2pp \ + build/$(a)/.image $(call boot1,$(a))/M1pp $(call boot1,$(a))/hex2pp \ vendor/seed/$(a)/ELF.hex2) TEST_P1_DEPS := $(foreach a,$(TEST_ARCHES), \ - build/$(a)/.image build/$(a)/tools/M0 P1/P1-$(a).M1 \ - build/$(a)/M1pp/M1pp build/$(a)/hex2pp/hex2pp vendor/seed/$(a)/ELF.hex2) + build/$(a)/.image $(call boot0,$(a))/M0 $(call boot0,$(a))/hex2 \ + P1/P1-$(a).M1 \ + $(call boot1,$(a))/M1pp $(call boot1,$(a))/hex2pp \ + vendor/seed/$(a)/ELF.hex2) TEST_SCHEME1_DEPS := $(foreach a,$(TEST_ARCHES), \ - build/$(a)/.image build/$(a)/M1pp/M1pp build/$(a)/hex2pp/hex2pp \ - build/$(a)/scheme1/scheme1 build/$(a)/tools/catm) + build/$(a)/.image \ + $(call boot1,$(a))/M1pp $(call boot1,$(a))/hex2pp \ + $(call boot2,$(a))/scheme1 $(call boot2,$(a))/catm) TEST_CC_UNIT_DEPS := $(foreach a,$(TEST_ARCHES), \ - build/$(a)/.image build/$(a)/tools/catm \ - build/$(a)/M1pp/M1pp build/$(a)/hex2pp/hex2pp \ - build/$(a)/scheme1/scheme1) + build/$(a)/.image \ + $(call boot1,$(a))/M1pp $(call boot1,$(a))/hex2pp \ + $(call boot2,$(a))/scheme1 $(call boot2,$(a))/catm) -TEST_CC_DEPS := $(TEST_CC_UNIT_DEPS) \ - $(foreach a,$(TEST_ARCHES),build/$(a)/cc/cc.scm) +TEST_CC_DEPS := $(TEST_CC_UNIT_DEPS) build/cc.scm TEST_CC_LIBC_DEPS := $(TEST_CC_DEPS) \ - $(foreach a,$(TEST_ARCHES),build/$(a)/vendor/mes-libc/libc.P1pp) \ + $(foreach a,$(TEST_ARCHES),$(call boot3,$(a))/libc.P1pp) \ P1/entry-libc.P1pp P1/elf-end.P1pp TEST_TCC_CC_DEPS := build/$(ARCH)/.image \ - $(TCC_TCC_BIN) $(TCC_TCC_TCC_BIN) \ - $(TCC_CC_START) $(TCC_CC_MEM) $(TCC_CC_VA_LIST) + $(call boot4,$(ARCH))/tcc1 $(call boot4,$(ARCH))/tcc2 \ + $(call boot4,$(ARCH))/libtcc1.a \ + $(TCC_CC_START) $(TCC_CC_VA_LIST) \ + build/$(ARCH)/src/.stamp TEST_TCC_LIBC_DEPS := build/$(ARCH)/.image \ - $(TCC_TCC_BIN) $(TCC_TCC_TCC_BIN) \ - $(TCC_LIBC_START) $(TCC_LIBC_SYS_STUBS) $(TCC_LIBC_MEM) $(TCC_LIBC_LIBC) \ - $(TCC_CC_VA_LIST) + $(call boot4,$(ARCH))/tcc1 $(call boot4,$(ARCH))/tcc2 \ + $(call boot4,$(ARCH))/libtcc1.a \ + $(call boot5,$(ARCH))/libc.a \ + $(TCC_LIBC_START) $(TCC_LIBC_SYS_STUBS) \ + $(TCC_CC_VA_LIST) \ + build/$(ARCH)/src/.stamp .PHONY: test test: diff --git a/tests/build-cc.sh b/tests/build-cc.sh @@ -33,8 +33,8 @@ set -eu SRC=$1 OUT=$2 -SCHEME1_BIN=build/$ARCH/scheme1/scheme1 -CC_SRC=build/$ARCH/cc/cc.scm +SCHEME1_BIN=build/$ARCH/podman/boot2/scheme1 +CC_SRC=build/cc.scm [ -x "$SCHEME1_BIN" ] || { echo "missing $SCHEME1_BIN" >&2; exit 1; } [ -e "$CC_SRC" ] || { echo "missing $CC_SRC" >&2; exit 1; } diff --git a/tests/build-p1.sh b/tests/build-p1.sh @@ -59,7 +59,8 @@ OUT=$2 TABLE=P1/P1-$ARCH.M1 ELF_HDR=vendor/seed/$ARCH/ELF.hex2 -TOOLS=build/$ARCH/tools +BOOT0=build/$ARCH/podman/boot0 +BOOT2=build/$ARCH/podman/boot2 NAME=${SRC%.*} WORK=build/$ARCH/.work/$NAME mkdir -p "$WORK" "$(dirname "$OUT")" @@ -70,18 +71,18 @@ cp /tmp/combined.M1 "$WORK/combined.M1" trace "combined.M1" /tmp/combined.M1 step "M0: combined.M1 -> prog.hex2" -"$TOOLS/M0" /tmp/combined.M1 /tmp/prog.hex2 +"$BOOT0/M0" /tmp/combined.M1 /tmp/prog.hex2 cp /tmp/prog.hex2 "$WORK/prog.hex2" trace "prog.hex2" /tmp/prog.hex2 step "catm: ELF header + prog.hex2 -> linked.hex2" cp "$ELF_HDR" /tmp/elf.hex2 -"$TOOLS/catm" /tmp/linked.hex2 /tmp/elf.hex2 /tmp/prog.hex2 +"$BOOT2/catm" /tmp/linked.hex2 /tmp/elf.hex2 /tmp/prog.hex2 cp /tmp/linked.hex2 "$WORK/linked.hex2" trace "linked.hex2" /tmp/linked.hex2 -step "hex2-0: linked.hex2 -> $OUT" -"$TOOLS/hex2-0" /tmp/linked.hex2 /tmp/prog.bin +step "hex2: linked.hex2 -> $OUT" +"$BOOT0/hex2" /tmp/linked.hex2 /tmp/prog.bin cp /tmp/prog.bin "$OUT" chmod 0700 "$OUT" trace "$OUT" "$OUT" diff --git a/tests/build-p1pp.sh b/tests/build-p1pp.sh @@ -3,10 +3,10 @@ ## ## Pure transformation. Caller (the Makefile) ensures every fixed-path ## input below already exists, including the per-arch self-hosted M1pp -## ELF binary (build/$ARCH/M1pp/M1pp) and hex2pp ELF binary -## (build/$ARCH/hex2pp/hex2pp). Both of those are built once via the -## seed M0+hex2 chain (tests/build-p1.sh); after that point the seed -## tools no longer participate in any user/test pipeline. +## ELF binary (build/$ARCH/podman/boot1/M1pp) and hex2pp ELF binary +## (build/$ARCH/podman/boot1/hex2pp). Both of those are built once via +## the seed M0+hex2 chain inside the bootN pipeline; after that point +## the seed tools no longer participate in any user/test pipeline. ## ## Pipeline (new chain — no M0/hex2 anywhere): ## cat <P1-$ARCH.M1pp> <P1.M1pp> <P1pp.P1pp> <srcs...> -> /tmp/combined.M1pp @@ -28,7 +28,7 @@ ## ## Multiple <srcs> are concatenated in the order given. This is how ## libc-using executables compose: a typical chain is -## P1/entry-libc.P1pp build/$ARCH/vendor/mes-libc/libc.P1pp client.P1pp P1/elf-end.P1pp +## P1/entry-libc.P1pp build/$ARCH/podman/boot3/libc.P1pp client.P1pp P1/elf-end.P1pp ## with libc.P1pp / client.P1pp produced by cc.scm --lib=PFX so they ## omit the entry stub and trailing :ELF_end (those come from the ## fixed fragments instead). For a single-TU exec, pass exactly one @@ -87,8 +87,8 @@ BACKEND=P1/P1-$ARCH.M1pp FRONTEND=P1/P1.M1pp LIBP1PP=P1/P1pp.P1pp ELF_HDR=vendor/seed/$ARCH/ELF.hex2 -M1PP_BIN=build/$ARCH/M1pp/M1pp -HEX2PP_BIN=build/$ARCH/hex2pp/hex2pp +M1PP_BIN=build/$ARCH/podman/boot1/M1pp +HEX2PP_BIN=build/$ARCH/podman/boot1/hex2pp if [ -n "${WORK_SUBPATH:-}" ]; then NAME=$WORK_SUBPATH else diff --git a/tests/run-suite.sh b/tests/run-suite.sh @@ -74,7 +74,7 @@ run_m1pp_suite() { outfile=build/$ARCH/tests/M1pp/$name.hex2pp mkdir -p "$(dirname "$outfile")" rm -f "$outfile" - "./build/$ARCH/M1pp/M1pp" "$m1pp_src" "$outfile" >/dev/null 2>&1 || true + "./build/$ARCH/podman/boot1/M1pp" "$m1pp_src" "$outfile" >/dev/null 2>&1 || true if [ -e "$outfile" ]; then actual=$(cat "$outfile") else @@ -147,7 +147,7 @@ run_scheme1_suite() { fi label="[$ARCH] $name" - bin=build/$ARCH/scheme1/scheme1 + bin=build/$ARCH/podman/boot2/scheme1 if [ ! -x "$bin" ]; then report "$label" FAIL echo " (missing $bin -- run 'make scheme1 ARCH=$ARCH')" >&2 @@ -201,8 +201,8 @@ _cc_unit_suite() { # Wrap in `sh -c` so catm failure doesn't abort under set -e and # scheme1 still runs (matches host runner's prior behavior). if sh -c " - build/$ARCH/tools/catm /tmp/cc-test.scm $layers $fixture - exec build/$ARCH/scheme1/scheme1 /tmp/cc-test.scm + build/$ARCH/podman/boot2/catm /tmp/cc-test.scm $layers $fixture + exec build/$ARCH/podman/boot2/scheme1 /tmp/cc-test.scm " >"$tmp" 2>&1; then act_exit=0 else @@ -236,8 +236,8 @@ _cc_pipeline_suite() { fi tmp=$(mktemp) if sh -c " - build/$ARCH/tools/catm /tmp/cc-test.scm $layers - exec build/$ARCH/scheme1/scheme1 /tmp/cc-test.scm $fixture + build/$ARCH/podman/boot2/catm /tmp/cc-test.scm $layers + exec build/$ARCH/podman/boot2/scheme1 /tmp/cc-test.scm $fixture " >"$tmp" 2>&1; then act_exit=0 else @@ -297,13 +297,13 @@ _cc_runtime_suite() { if [ "$arg_pass" = "1" ]; then cmd=" - build/$ARCH/tools/catm /tmp/cc-test.scm $layers - exec build/$ARCH/scheme1/scheme1 /tmp/cc-test.scm $fixture + build/$ARCH/podman/boot2/catm /tmp/cc-test.scm $layers + exec build/$ARCH/podman/boot2/scheme1 /tmp/cc-test.scm $fixture " else cmd=" - build/$ARCH/tools/catm /tmp/cc-test.scm $layers $fixture - exec build/$ARCH/scheme1/scheme1 /tmp/cc-test.scm + build/$ARCH/podman/boot2/catm /tmp/cc-test.scm $layers $fixture + exec build/$ARCH/podman/boot2/scheme1 /tmp/cc-test.scm " fi label="[$ARCH] $suite/$name" @@ -360,7 +360,7 @@ run_cc_suite() { cc_log=$workdir/cc.log # shellcheck disable=SC2086 # CC_EXTRA_FLAGS is intentionally word-split. - if ! build/$ARCH/scheme1/scheme1 build/$ARCH/cc/cc.scm $CC_EXTRA_FLAGS \ + if ! build/$ARCH/podman/boot2/scheme1 build/cc.scm $CC_EXTRA_FLAGS \ "$src" "$p1pp" >"$cc_log" 2>&1; then fail "$label" "cc compile failed:" "$cc_log" continue @@ -418,7 +418,7 @@ run_cc_libc_suite() { # libc__cc__str_N. cc_log=$workdir/cc.log # shellcheck disable=SC2086 # CC_EXTRA_FLAGS is intentionally word-split. - if ! build/$ARCH/scheme1/scheme1 build/$ARCH/cc/cc.scm $CC_EXTRA_FLAGS \ + if ! build/$ARCH/podman/boot2/scheme1 build/cc.scm $CC_EXTRA_FLAGS \ --lib=app__ "$src" "$client_p1pp" \ >"$cc_log" 2>&1; then fail "$label" "cc compile failed:" "$cc_log" @@ -431,7 +431,7 @@ run_cc_libc_suite() { p1pp_log=$workdir/p1pp.log if ! WORK_SUBPATH=tests/cc-libc/$name \ sh tests/build-p1pp.sh "$elf" \ - P1/entry-libc.P1pp build/$ARCH/vendor/mes-libc/libc.P1pp \ + P1/entry-libc.P1pp build/$ARCH/podman/boot3/libc.P1pp \ "$client_p1pp" P1/elf-end.P1pp \ >"$p1pp_log" 2>&1; then fail "$label" "P1pp assemble failed:" "$p1pp_log" @@ -500,7 +500,7 @@ run_cc_ext_suite() { # emit its own :p1_main / :ELF_end and namespaces anonymous # string labels under app__cc__str_N (libc supplies its own). # shellcheck disable=SC2086 # CC_EXTRA_FLAGS is intentionally word-split. - if ! build/$ARCH/scheme1/scheme1 build/$ARCH/cc/cc.scm $CC_EXTRA_FLAGS \ + if ! build/$ARCH/podman/boot2/scheme1 build/cc.scm $CC_EXTRA_FLAGS \ --lib=app__ "$src" "$client_p1pp" \ >"$cc_log" 2>&1; then fail "$label" "cc compile failed:" "$cc_log" @@ -508,7 +508,7 @@ run_cc_ext_suite() { fi else # shellcheck disable=SC2086 # CC_EXTRA_FLAGS is intentionally word-split. - if ! build/$ARCH/scheme1/scheme1 build/$ARCH/cc/cc.scm $CC_EXTRA_FLAGS \ + if ! build/$ARCH/podman/boot2/scheme1 build/cc.scm $CC_EXTRA_FLAGS \ "$src" "$client_p1pp" \ >"$cc_log" 2>&1; then fail "$label" "cc compile failed:" "$cc_log" @@ -523,7 +523,7 @@ run_cc_ext_suite() { # routines, the client :main, elf-end the :ELF_end terminator. if ! WORK_SUBPATH=tests/cc-ext/$name \ sh tests/build-p1pp.sh "$elf" \ - P1/entry-libc.P1pp build/$ARCH/vendor/mes-libc/libc.P1pp \ + P1/entry-libc.P1pp build/$ARCH/podman/boot3/libc.P1pp \ "$client_p1pp" P1/elf-end.P1pp \ >"$p1pp_log" 2>&1; then fail "$label" "P1pp assemble failed:" "$p1pp_log" @@ -571,8 +571,8 @@ run_tcc_cc_suite() { esac case "${STAGE:-2}" in - 2) tcc=build/$ARCH/tcc-tcc/tcc-tcc; stage_tag=stage2 ;; - 3) tcc=build/$ARCH/tcc-tcc-tcc/tcc-tcc-tcc; stage_tag=stage3 ;; + 2) tcc=build/$ARCH/podman/boot4/tcc1; stage_tag=stage2 ;; + 3) tcc=build/$ARCH/podman/boot4/tcc2; stage_tag=stage3 ;; *) echo " FAIL [$ARCH] tcc-cc" echo " unknown STAGE='$STAGE' (expected 2 or 3)" >&2 @@ -580,8 +580,8 @@ run_tcc_cc_suite() { ;; esac start=build/$ARCH/tcc-cc/start.o - mem=build/$ARCH/tcc-cc/mem.o - tcc_include=build/$ARCH/vendor/tcc/tcc-0.9.26-1147-gee75a10c/include + libtcc1=build/$ARCH/podman/boot4/libtcc1.a + tcc_include=build/$ARCH/src/src/tcc/tcc-0.9.26-1147-gee75a10c/include # x86_64 only: __va_start / __va_arg intrinsics for variadic # functions. Other arches lower va_arg without out-of-line helpers. if [ "$ARCH" = "amd64" ]; then @@ -599,9 +599,9 @@ run_tcc_cc_suite() { echo " missing $start -- run 'make test SUITE=tcc-cc ARCH=$ARCH'" >&2 return fi - if [ ! -e "$mem" ]; then + if [ ! -e "$libtcc1" ]; then echo " FAIL [$ARCH] tcc-cc" - echo " missing $mem -- run 'make test SUITE=tcc-cc ARCH=$ARCH'" >&2 + echo " missing $libtcc1 -- run 'make test SUITE=tcc-cc ARCH=$ARCH'" >&2 return fi if [ -n "$va_list" ] && [ ! -e "$va_list" ]; then @@ -638,7 +638,7 @@ run_tcc_cc_suite() { tcc_log=$workdir/tcc.log # shellcheck disable=SC2086 # $va_list is intentionally word-split (may be empty). if ! "$tcc" -nostdlib -I "$tcc_include" \ - "$start" "$mem" $va_list "$src" -o "$elf" \ + "$start" "$libtcc1" $va_list "$src" -o "$elf" \ >"$tcc_log" 2>&1; then fail "$label" "tcc compile/link failed:" "$tcc_log" continue @@ -680,8 +680,8 @@ run_tcc_libc_suite() { esac case "${STAGE:-2}" in - 2) tcc=build/$ARCH/tcc-tcc/tcc-tcc; stage_tag=stage2 ;; - 3) tcc=build/$ARCH/tcc-tcc-tcc/tcc-tcc-tcc; stage_tag=stage3 ;; + 2) tcc=build/$ARCH/podman/boot4/tcc1; stage_tag=stage2 ;; + 3) tcc=build/$ARCH/podman/boot4/tcc2; stage_tag=stage3 ;; *) echo " FAIL [$ARCH] tcc-libc" echo " unknown STAGE='$STAGE' (expected 2 or 3)" >&2 @@ -690,9 +690,9 @@ run_tcc_libc_suite() { esac start=build/$ARCH/tcc-libc/start.o sys_stubs=build/$ARCH/tcc-libc/sys_stubs.o - mem=build/$ARCH/tcc-libc/mem.o - libc=build/$ARCH/tcc-libc/libc.o - tcc_include=build/$ARCH/vendor/tcc/tcc-0.9.26-1147-gee75a10c/include + libtcc1=build/$ARCH/podman/boot4/libtcc1.a + libc=build/$ARCH/podman/boot5/libc.a + tcc_include=build/$ARCH/src/src/tcc/tcc-0.9.26-1147-gee75a10c/include # x86_64 only: __va_start / __va_arg intrinsics for variadic # functions. mes-libc's printf family hits this directly. if [ "$ARCH" = "amd64" ]; then @@ -700,7 +700,7 @@ run_tcc_libc_suite() { else va_list= fi - for f in "$tcc" "$start" "$sys_stubs" "$mem" "$libc"; do + for f in "$tcc" "$start" "$sys_stubs" "$libtcc1" "$libc"; do if [ ! -e "$f" ]; then echo " FAIL [$ARCH] tcc-libc" echo " missing $f -- run 'make test SUITE=tcc-libc ARCH=$ARCH'" >&2 @@ -741,7 +741,7 @@ run_tcc_libc_suite() { tcc_log=$workdir/tcc.log # shellcheck disable=SC2086 # $va_list is intentionally word-split (may be empty). if ! "$tcc" -nostdlib -I "$tcc_include" \ - "$start" "$sys_stubs" "$mem" "$libc" $va_list "$src" -o "$elf" \ + "$start" "$sys_stubs" "$libtcc1" "$libc" $va_list "$src" -o "$elf" \ >"$tcc_log" 2>&1; then fail "$label" "tcc compile/link failed:" "$tcc_log" continue