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