From 493a2437627e98fdd15beb34321acad20d906b74 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 16 Jun 2026 01:38:48 -0400 Subject: [PATCH] selfhost-verify: parchea el hello_world final de run_rustc (snag #2 en Makefile:262) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Con el muro de proc-macros roto (stage0 musl-host), run_rustc avanzó por primera vez hasta el smoke-test hello_world del prefix FINAL (Makefile:262) y falló igual que el de stage-1: usa el default musl -static-pie + CRT self-contained ausente (rcrt1.o/crti.o/crtbeginS.o/crtendS.o/crtn.o + -lunwind estático) -> ld: cannot find. Fix idéntico al de la línea 172: añade --target $(RUSTC_TARGET) -C target-feature= -crt-static -C link-self-contained=no a la regla del hello final. run_rustc.patch regenerado (vs be69c74) e incluye ahora ambas reglas; README snag #2 documenta las dos. Verificado parcialmente: stage-2 rustc, stage-3 rustc y cargo se construyeron OK antes del fallo (proc-macros nativos: tinystr/displaydoc/icu compilan). Rebuild en curso. Co-Authored-By: Claude Opus 4.8 --- scripts/rust-frontier/README.md | 9 ++++++--- scripts/rust-frontier/run_rustc.patch | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/rust-frontier/README.md b/scripts/rust-frontier/README.md index c3b457ba..54aebdce 100644 --- a/scripts/rust-frontier/README.md +++ b/scripts/rust-frontier/README.md @@ -40,9 +40,12 @@ to bootstrap a usable rust there: 2. **self-contained CRT absent.** musl's default link is `-static-pie` against a `lib/rustlib//lib/self-contained/` CRT dir that the mrustc sysroot never - populates. Fix: `-C target-feature=-crt-static -C link-self-contained=no` so the - Alpine gcc supplies crt1/crti/crtn + crtbeginS/crtendS and links dynamically - against the system musl (RUSTFLAGS in Makefile:111, plus the per-link sites). + populates (also needs static `-lunwind`). Fix: `-C target-feature=-crt-static + -C link-self-contained=no` so the Alpine gcc supplies crt1/crti/crtn + + crtbeginS/crtendS and links dynamically against the system musl (RUSTFLAGS in + Makefile:111, plus **both** hello_world smoke-test rules: the stage-1 one at + Makefile:172 *and* the final fully-bootstrapped one at Makefile:262 — the latter + only surfaces once stage-2/3 actually completes, i.e. after snag #3 is fixed). 3. **host-triple = gnu on a musl system** (the deep one). cargo compiles build-scripts and **proc-macros** for the *host*; mrustc's stage0 rustc has its diff --git a/scripts/rust-frontier/run_rustc.patch b/scripts/rust-frontier/run_rustc.patch index 2e503132..67e2d199 100644 --- a/scripts/rust-frontier/run_rustc.patch +++ b/scripts/rust-frontier/run_rustc.patch @@ -1,5 +1,5 @@ diff --git a/run_rustc/Makefile b/run_rustc/Makefile -index e78d8c5..4d6ef5d 100644 +index e78d8c5..00162a7 100644 --- a/run_rustc/Makefile +++ b/run_rustc/Makefile @@ -108,7 +108,7 @@ CARGO_FLAGS := --target $(RUSTC_TARGET) -j $(PARLEVEL) --release --verbose @@ -29,6 +29,15 @@ index e78d8c5..4d6ef5d 100644 # --- # Stage 2: Build a proper libstd (which includes dynamc libraries too) +@@ -259,7 +259,7 @@ endif + $(BINDIR)hello_world: $(RUST_SRC_HELLO) $(BINDIR)rustc $(LIBDIR)libstd.rlib + @mkdir -p $(dir $@) + @echo "[RUSTC] -o $@" +- $V$(DBG) $(BINDIR)rustc -L $(LIBDIR) $< -o $@ ++ $V$(DBG) $(BINDIR)rustc --target $(RUSTC_TARGET) -C target-feature=-crt-static -C link-self-contained=no -L $(LIBDIR) $< -o $@ + ./$@ + + #.PHONY: TEST_BOOTSTRAP diff --git a/run_rustc/rustc_proxy.sh b/run_rustc/rustc_proxy.sh index 3f4f2b9..78f6f1d 100755 --- a/run_rustc/rustc_proxy.sh