sergio/takana
> Una distribución Linux construida con un laboratorio funcional y hermético en el > sótano, y una terminal mutable, clásica y anárquica en el piso de arriba — diseñada > desde el suelo para que una IA programadora entienda, modifique y co…
⎇ 493a2437627e98fdd15beb34321acad20d906b74
scripts/rust-frontier/run_rustc.patch
Ñawpa willay
ch'uya
selfhost-verify: parchea el hello_world final de run_rustc (snag #2 en Makefile:262)
1diff --git a/run_rustc/Makefile b/run_rustc/Makefile
2index e78d8c5..00162a7 100644
3--- a/run_rustc/Makefile
4+++ b/run_rustc/Makefile
5@@ -108,7 +108,7 @@ CARGO_FLAGS := --target $(RUSTC_TARGET) -j $(PARLEVEL) --release --verbose
6 CARGO_ENV := CFG_COMPILER_HOST_TRIPLE=$(RUSTC_TARGET)
7 CARGO_ENV += RUSTC_BOOTSTRAP=1
8 CARGO_ENV += CARGO_HOME=$(CARGO_HOME)
9-CARGO_ENV += RUSTFLAGS="-Z force-unstable-if-unmarked -C link_args=-Wl,-rpath,\$$ORIGIN/../lib -C target-feature=-crt-static"
10+CARGO_ENV += RUSTFLAGS="-Z force-unstable-if-unmarked -C link_args=-Wl,-rpath,\$$ORIGIN/../lib -C target-feature=-crt-static -C link-self-contained=no"
11
12 fn_opt_copy = (test -e "$2" && test ! "$1" -nt "$2") || cp "$1" "$2"
13
14@@ -159,7 +159,7 @@ $(LIBDIR_S)libstd.rlib: $(BINDIR_S)rustc $(MINICARGO) Makefile
15 @echo "[MINICARGO] $(RUST_SRC_LIBS)std > $(LIBDIR_S)"
16 mkdir -p $(LIBDIR_S)
17 ifneq ($(TARGETVER_LEAST_1_74),)
18- $V+STD_ENV_ARCH=$(RUSTC_ARCH) MRUSTC_PATH=$(abspath $(BINDIR_S)rustc) $(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides ../script-overrides/stable-$(RUSTC_VERSION)-$(PLATFORM)/ --output-dir $(LIBDIR_S) $(RUST_SRC_LIBS)sysroot
19+ $V+STD_ENV_ARCH=$(RUSTC_ARCH) MRUSTC_PATH=$(abspath $(BINDIR_S)rustc) $(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides ../script-overrides/stable-$(RUSTC_VERSION)-$(PLATFORM)/ --output-dir $(LIBDIR_S) --target $(RUSTC_TARGET) $(RUST_SRC_LIBS)sysroot
20 else
21 $V+MRUSTC_PATH=$(abspath $(BINDIR_S)rustc) $(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides ../script-overrides/stable-$(RUSTC_VERSION)-$(PLATFORM)/ --output-dir $(LIBDIR_S) $(RUST_SRC_LIBS)std
22 $V+MRUSTC_PATH=$(abspath $(BINDIR_S)rustc) $(MINICARGO) --vendor-dir $(VENDOR_DIR) --script-overrides ../script-overrides/stable-$(RUSTC_VERSION)-$(PLATFORM)/ --output-dir $(LIBDIR_S) $(RUST_SRC_LIBS)panic_unwind
23@@ -169,7 +169,7 @@ endif
24 # Build hello_world using the bootstrapping compiler (mrustc-built rustc)
25 $(BINDIR_S)hello_world: $(RUST_SRC_HELLO) $(LIBDIR_S)libstd.rlib $(BINDIR_S)rustc
26 @mkdir -p $(dir $@)
27- $V$(BINDIR_S)rustc $(RUSTFLAGS_$@) -L $(LIBDIR_S) $< -o $@
28+ $V$(BINDIR_S)rustc $(RUSTFLAGS_$@) --target $(RUSTC_TARGET) -C target-feature=-crt-static -C link-self-contained=no -L $(LIBDIR_S) $< -o $@
29
30 # ---
31 # Stage 2: Build a proper libstd (which includes dynamc libraries too)
32@@ -259,7 +259,7 @@ endif
33 $(BINDIR)hello_world: $(RUST_SRC_HELLO) $(BINDIR)rustc $(LIBDIR)libstd.rlib
34 @mkdir -p $(dir $@)
35 @echo "[RUSTC] -o $@"
36- $V$(DBG) $(BINDIR)rustc -L $(LIBDIR) $< -o $@
37+ $V$(DBG) $(BINDIR)rustc --target $(RUSTC_TARGET) -C target-feature=-crt-static -C link-self-contained=no -L $(LIBDIR) $< -o $@
38 ./$@
39
40 #.PHONY: TEST_BOOTSTRAP
41diff --git a/run_rustc/rustc_proxy.sh b/run_rustc/rustc_proxy.sh
42index 3f4f2b9..78f6f1d 100755
43--- a/run_rustc/rustc_proxy.sh
44+++ b/run_rustc/rustc_proxy.sh
45@@ -17,7 +17,12 @@ if is_target "$@"; then
46 #echo " [REAL]" "$@" >&2
47 ${PROXY_RUSTC} "$@"
48 else
49+ # Host (build-script / proc-macro) build. With the musl-host stage0 rustc its
50+ # default target IS x86_64-unknown-linux-musl, so no --target inject is needed
51+ # (host==target==musl, proc-macros load natively). Just force dynamic +
52+ # non-self-contained so the Alpine gcc supplies the CRT (the mrustc sysroot has
53+ # no self-contained CRT dir, and musl's default is static-pie).
54 #echo " [BOOTSTRAP]" "$@" >&2
55- ${PROXY_MRUSTC} "$@"
56+ ${PROXY_MRUSTC} -C target-feature=-crt-static -C link-self-contained=no "$@"
57 fi
58