nocc: stage-0 bootstrap path (binaries gitignored)
Sets up the cc-free fresh-checkout flow without yet committing the
stage-0 binaries. The pieces are in place; flipping the switch is
one `git add -f` away when the compiler is judged stable.
bootstrap/<arch>/{ww,6c,6a,6l} stage-0 binaries (gitignored)
bootstrap/README.md layout + workflow
Two new targets:
make bootstrap-snapshot populates bootstrap/$(ARCH)/ from the
currently-built wwstage
make nocc starts from bootstrap/$(ARCH)/, rebuilds
the wwstage from source, gates on
stage-0 == rebuilt byte-for-byte. Lands
in $(OUT)/nocc/ so $(OUT)/ stays
untouched. cc is never invoked.
The fixed-point gate has the same shape as `make bootstrap`, just
the entry point flipped: that target trusts cstage; nocc trusts
the checked-in (or local-snapshot) stage-0 binaries.
Implementation notes:
- libwwrt.a is assembled with stage-0 6a, members ordered to match
$(RT_OBJ) so the embedded symbol table reproduces the cstage
build byte-for-byte.
- The driver's default lib path is $self_dir/../../lib, which under
$(NOCC_BIN) resolves to $(NOCC_OUT)/lib (libwwrt only). Each
ww-build invocation passes -I $(CURDIR)/lib so `use os` etc.
resolve to source.
- Stage-0 binaries are duplicated under both natural names (ww/6c/
6a/6l) and _ww-suffixed names so the wwstage driver's
hard-coded join_path_lit(self_dir, "6c_ww") still finds them.
When cmd/wwc/ gets deleted at v1.0, that duplication and the
_ww suffix in the driver both go away.
This commit is contained in:
76
Makefile
76
Makefile
@@ -307,4 +307,78 @@ bootstrap: all
|
||||
@echo " - cmd/6l/ : ww-6l (linker w/ archive support) — byte-identical to C 6l (test 992)"
|
||||
@echo " - cmd/ww/ : ww-driver (build/run/version) — byte-identical to C ww (test 993)"
|
||||
|
||||
.PHONY: all cstage wwstage test install clean bootstrap
|
||||
# ---- nocc: bootstrap from a checked-in stage-0 binary, no cc -----------
|
||||
# A fresh-checkout flow that never invokes cc. Mirrors `make bootstrap`'s
|
||||
# fixed-point check but uses `bootstrap/$(ARCH)/{ww,6c,6a,6l}` as the
|
||||
# starting point and lands in $(OUT)/nocc/ so the cstage build under
|
||||
# $(OUT)/ stays untouched. See bootstrap/README.md and BOOTSTRAP.md.
|
||||
#
|
||||
# `make bootstrap-snapshot` populates bootstrap/$(ARCH)/ from the
|
||||
# currently-built wwstage so you can verify locally before deciding
|
||||
# to commit the binaries.
|
||||
ARCH ?= amd64
|
||||
STAGE0 = bootstrap/$(ARCH)
|
||||
NOCC_OUT = $(OUT)/nocc
|
||||
NOCC_BIN = $(NOCC_OUT)/bin
|
||||
NOCC_LIB = $(NOCC_OUT)/lib
|
||||
NOCC_OBJ = $(NOCC_OUT)/obj
|
||||
|
||||
bootstrap-snapshot: wwstage
|
||||
@mkdir -p $(STAGE0)
|
||||
@cp $(BIN)/ww_ww $(STAGE0)/ww
|
||||
@cp $(BIN)/6c_ww $(STAGE0)/6c
|
||||
@cp $(BIN)/6a_ww $(STAGE0)/6a
|
||||
@cp $(BIN)/6l_ww $(STAGE0)/6l
|
||||
@echo "snapshot: $(STAGE0)/{ww,6c,6a,6l} populated from $(BIN)/*_ww"
|
||||
@echo " (gitignored — 'git add -f bootstrap/$(ARCH)/*' to ship)"
|
||||
|
||||
nocc:
|
||||
@for f in ww 6c 6a 6l; do \
|
||||
test -x $(STAGE0)/$$f || { \
|
||||
echo "$@: missing $(STAGE0)/$$f"; \
|
||||
echo "$@: run 'make bootstrap-snapshot' first, or read bootstrap/README.md"; \
|
||||
exit 1; \
|
||||
}; \
|
||||
done
|
||||
@echo "=== nocc: starting from $(STAGE0) (no cc invoked) ==="
|
||||
@rm -rf $(NOCC_OUT)
|
||||
@mkdir -p $(NOCC_BIN) $(NOCC_LIB) $(NOCC_OBJ)
|
||||
@# Stage 0: drop bootstrap binaries under both natural names and
|
||||
@# the _ww-suffixed names the driver expects when shelling out.
|
||||
@for f in ww 6c 6a 6l; do \
|
||||
cp $(STAGE0)/$$f $(NOCC_BIN)/$$f; \
|
||||
cp $(STAGE0)/$$f $(NOCC_BIN)/$${f}_ww; \
|
||||
done
|
||||
@# Assemble libwwrt.a using stage-0 6a — the linker needs it for
|
||||
@# every wwstage-built binary in the next stage. Member order
|
||||
@# follows $(RT_S) so the embedded symbol table matches the
|
||||
@# cstage-built libwwrt.a (cstage uses ar rcs $(RT_OBJ), same
|
||||
@# order).
|
||||
@objs=""; for s in $(RT_S); do \
|
||||
b=`basename $$s .s`; \
|
||||
$(NOCC_BIN)/6a -o $(NOCC_OBJ)/$$b.o $$s; \
|
||||
objs="$$objs $(NOCC_OBJ)/$$b.o"; \
|
||||
done; $(AR) rcs $(NOCC_LIB)/libwwrt.a $$objs
|
||||
@echo "=== stage 1: stage-0 rebuilds the wwstage tools from source ==="
|
||||
@# The driver's default lib path is $self_dir/../../lib — under
|
||||
@# $(NOCC_BIN) that resolves to $(NOCC_OUT)/lib (libwwrt only).
|
||||
@# Pass -I $(CURDIR)/lib so `use os` etc. resolve to source.
|
||||
@cd $(NOCC_BIN) && ./ww build -I $(CURDIR)/selfhost/cmd/wwc \
|
||||
-I $(CURDIR)/lib $(CURDIR)/selfhost/cmd/6c/main.ww && mv main 6c_ww1
|
||||
@cd $(NOCC_BIN) && ./ww build -I $(CURDIR)/selfhost/cmd/6a \
|
||||
-I $(CURDIR)/selfhost/cmd/wwc -I $(CURDIR)/lib \
|
||||
$(CURDIR)/selfhost/cmd/6a/main.ww && mv main 6a_ww1
|
||||
@cd $(NOCC_BIN) && ./ww build -I $(CURDIR)/selfhost/cmd/6l \
|
||||
-I $(CURDIR)/selfhost/cmd/wwc -I $(CURDIR)/lib \
|
||||
$(CURDIR)/selfhost/cmd/6l/main.ww && mv main 6l_ww1
|
||||
@cd $(NOCC_BIN) && ./ww build -I $(CURDIR)/selfhost/cmd/wwc \
|
||||
-I $(CURDIR)/lib $(CURDIR)/selfhost/cmd/ww/main.ww && mv main ww_ww1
|
||||
@echo "=== fixed-point gates: rebuilt tools == stage-0 binaries? ==="
|
||||
@cmp $(NOCC_BIN)/6c_ww1 $(STAGE0)/6c && echo " 6c ✓"
|
||||
@cmp $(NOCC_BIN)/6a_ww1 $(STAGE0)/6a && echo " 6a ✓"
|
||||
@cmp $(NOCC_BIN)/6l_ww1 $(STAGE0)/6l && echo " 6l ✓"
|
||||
@cmp $(NOCC_BIN)/ww_ww1 $(STAGE0)/ww && echo " ww ✓"
|
||||
@echo
|
||||
@echo "NOCC OK: $(STAGE0)/* reproduces itself from source. cc not invoked."
|
||||
|
||||
.PHONY: all cstage wwstage test install clean bootstrap nocc bootstrap-snapshot
|
||||
|
||||
Reference in New Issue
Block a user