summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--experimental/rust-beta/0001-Fix-LLVM-build.patch22
-rw-r--r--experimental/rust-beta/0002-Fix-linking-to-zlib-when-cross-compiling.patch34
-rw-r--r--experimental/rust-beta/0003-Fix-rustdoc-when-cross-compiling-on-musl.patch50
-rw-r--r--experimental/rust-beta/0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch532
-rw-r--r--experimental/rust-beta/0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch25
-rw-r--r--experimental/rust-beta/0006-Link-libssp_nonshared.a-on-all-musl-targets.patch28
-rw-r--r--experimental/rust-beta/0007-test-failed-doctest-output-Fix-normalization.patch31
-rw-r--r--experimental/rust-beta/0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch22
-rw-r--r--experimental/rust-beta/0009-Ignore-broken-and-non-applicable-tests.patch47
-rw-r--r--experimental/rust-beta/0010-Link-stage-2-tools-dynamically-to-libstd.patch22
-rw-r--r--experimental/rust-beta/0011-Move-debugger-scripts-to-usr-share-rust.patch66
-rw-r--r--experimental/rust-beta/0012-Add-foxkit-target-specs.patch206
-rw-r--r--experimental/rust-beta/APKBUILD296
-rw-r--r--experimental/rust-beta/powerpc-atomics.patch16
-rw-r--r--experimental/rust-beta/stdarch-ppc.patch114
-rw-r--r--experimental/rust-beta/ui-test-strings.patch25
16 files changed, 1536 insertions, 0 deletions
diff --git a/experimental/rust-beta/0001-Fix-LLVM-build.patch b/experimental/rust-beta/0001-Fix-LLVM-build.patch
new file mode 100644
index 000000000..d49c17640
--- /dev/null
+++ b/experimental/rust-beta/0001-Fix-LLVM-build.patch
@@ -0,0 +1,22 @@
+From 855b7d97e96e67bd5db5c0016c3b9965a5c1843f Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 8 Sep 2017 00:04:29 -0500
+Subject: [PATCH 01/12] Fix LLVM build
+
+---
+ src/bootstrap/src/lib.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
+index 33b8f1a7ce720..d933a8bc37f88 100644
+--- a/src/bootstrap/src/lib.rs
++++ b/src/bootstrap/src/lib.rs
+@@ -1214,7 +1214,7 @@ impl Build {
+ .args()
+ .iter()
+ .map(|s| s.to_string_lossy().into_owned())
+- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
++ .filter(|s| !s.starts_with("-O") && !s.starts_with("/O") && !s.starts_with("-static"))
+ .collect::<Vec<String>>();
+
+ // If we're compiling C++ on macOS then we add a flag indicating that
diff --git a/experimental/rust-beta/0002-Fix-linking-to-zlib-when-cross-compiling.patch b/experimental/rust-beta/0002-Fix-linking-to-zlib-when-cross-compiling.patch
new file mode 100644
index 000000000..11e87ae93
--- /dev/null
+++ b/experimental/rust-beta/0002-Fix-linking-to-zlib-when-cross-compiling.patch
@@ -0,0 +1,34 @@
+From 9357baa3eede8062b7c17407d23c3d2102af8435 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Wed, 10 Jan 2018 13:36:41 -0600
+Subject: [PATCH 02/12] Fix linking to zlib when cross-compiling
+
+---
+ compiler/rustc_llvm/build.rs | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
+index 4b0c1229da134..2d61b834c784b 100644
+--- a/compiler/rustc_llvm/build.rs
++++ b/compiler/rustc_llvm/build.rs
+@@ -219,10 +219,8 @@ fn main() {
+ // of llvm-config, not the target that we're attempting to link.
+ let mut cmd = Command::new(&llvm_config);
+ cmd.arg(llvm_link_arg).arg("--libs");
+-
+- if !is_crossed {
+- cmd.arg("--system-libs");
+- }
++ cmd.arg("--system-libs");
++ cmd.args(&components);
+
+ // We need libkstat for getHostCPUName on SPARC builds.
+ // See also: https://github.com/llvm/llvm-project/issues/64186
+@@ -256,7 +254,6 @@ fn main() {
+ println!("cargo:rustc-link-lib=z");
+ println!("cargo:rustc-link-lib=execinfo");
+ }
+- cmd.args(&components);
+
+ for lib in output(&mut cmd).split_whitespace() {
+ let name = if let Some(stripped) = lib.strip_prefix("-l") {
diff --git a/experimental/rust-beta/0003-Fix-rustdoc-when-cross-compiling-on-musl.patch b/experimental/rust-beta/0003-Fix-rustdoc-when-cross-compiling-on-musl.patch
new file mode 100644
index 000000000..e1546dfc6
--- /dev/null
+++ b/experimental/rust-beta/0003-Fix-rustdoc-when-cross-compiling-on-musl.patch
@@ -0,0 +1,50 @@
+From cb97ef40ec507c7ff20f7c0857b1892a1946a0f3 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sat, 2 Dec 2017 17:25:44 -0600
+Subject: [PATCH 03/12] Fix rustdoc when cross-compiling on musl
+
+musl can't handle foreign-architecture libraries in LD_LIBRARY_PATH.
+---
+ src/bootstrap/src/bin/rustdoc.rs | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/src/bootstrap/src/bin/rustdoc.rs b/src/bootstrap/src/bin/rustdoc.rs
+index dbbce6fe22047..3d3cb241eaab6 100644
+--- a/src/bootstrap/src/bin/rustdoc.rs
++++ b/src/bootstrap/src/bin/rustdoc.rs
+@@ -7,6 +7,6 @@ use std::ffi::OsString;
+ use std::process::Command;
+
+ use shared_helpers::{
+- dylib_path, dylib_path_var, maybe_dump, parse_rustc_stage, parse_rustc_verbose,
++ dylib_path_var, maybe_dump, parse_rustc_stage, parse_rustc_verbose,
+ parse_value_from_args,
+ };
+@@ -28,9 +29,6 @@ fn main() {
+ // is passed (a bit janky...)
+ let target = args.windows(2).find(|w| &*w[0] == "--target").and_then(|w| w[1].to_str());
+
+- let mut dylib_path = dylib_path();
+- dylib_path.insert(0, PathBuf::from(libdir.clone()));
+-
+ let mut cmd = Command::new(rustdoc);
+
+ if target.is_some() {
+@@ -43,7 +41,7 @@ fn main() {
+ }
+
+ cmd.args(&args);
+- cmd.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
++ cmd.env(dylib_path_var(), PathBuf::from(libdir.clone()));
+
+ // Force all crates compiled by this compiler to (a) be unstable and (b)
+ // allow the `rustc_private` feature to link to other unstable crates
+@@ -68,7 +66,7 @@ fn main() {
+ eprintln!(
+ "rustdoc command: {:?}={:?} {:?}",
+ dylib_path_var(),
+- env::join_paths(&dylib_path).unwrap(),
++ PathBuf::from(libdir.clone()),
+ cmd,
+ );
+ eprintln!("sysroot: {sysroot:?}");
diff --git a/experimental/rust-beta/0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch b/experimental/rust-beta/0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch
new file mode 100644
index 000000000..7bcd9a532
--- /dev/null
+++ b/experimental/rust-beta/0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch
@@ -0,0 +1,532 @@
+From 7e2507b33ffb027a331f7cbd3477043288f49797 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 8 Sep 2017 22:11:14 -0500
+Subject: [PATCH 04/12] Remove musl_root and CRT fallback from musl targets
+
+---
+ compiler/rustc_codegen_ssa/src/back/link.rs | 6 +--
+ .../rustc_target/src/spec/base/linux_musl.rs | 6 +--
+ compiler/rustc_target/src/spec/crt_objects.rs | 22 ----------
+ compiler/rustc_target/src/spec/mod.rs | 5 ---
+ config.example.toml | 17 --------
+ src/bootstrap/configure.py | 34 ---------------
+ src/bootstrap/src/core/build_steps/compile.rs | 42 +------------------
+ src/bootstrap/src/core/config/config.rs | 11 -----
+ src/bootstrap/src/core/sanity.rs | 23 ----------
+ src/bootstrap/src/lib.rs | 19 ---------
+ src/bootstrap/src/utils/cc_detect.rs | 26 ------------
+ .../host-x86_64/dist-arm-linux/Dockerfile | 1 -
+ .../dist-i586-gnu-i586-i686-musl/Dockerfile | 2 -
+ .../host-x86_64/dist-various-1/Dockerfile | 4 --
+ .../host-x86_64/dist-various-2/Dockerfile | 3 +-
+ .../host-x86_64/dist-x86_64-musl/Dockerfile | 1 -
+ .../host-x86_64/test-various/Dockerfile | 1 -
+ 17 files changed, 4 insertions(+), 219 deletions(-)
+
+diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
+index f5e8d5fc92a91..b65999ec7230f 100644
+--- a/compiler/rustc_codegen_ssa/src/back/link.rs
++++ b/compiler/rustc_codegen_ssa/src/back/link.rs
+@@ -1806,7 +1806,7 @@ fn detect_self_contained_mingw(sess: &Session) -> bool {
+ /// Various toolchain components used during linking are used from rustc distribution
+ /// instead of being found somewhere on the host system.
+ /// We only provide such support for a very limited number of targets.
+-fn self_contained_components(sess: &Session, crate_type: CrateType) -> LinkSelfContainedComponents {
++fn self_contained_components(sess: &Session, _crate_type: CrateType) -> LinkSelfContainedComponents {
+ // Turn the backwards compatible bool values for `self_contained` into fully inferred
+ // `LinkSelfContainedComponents`.
+ let self_contained =
+@@ -1828,10 +1828,6 @@ fn self_contained_components(sess: &Session, crate_type: CrateType) -> LinkSelfC
+ return components;
+ }
+
+- // FIXME: Find a better heuristic for "native musl toolchain is available",
+- // based on host and linker path, for example.
+- // (https://github.com/rust-lang/rust/pull/71769#issuecomment-626330237).
+- LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)),
+ LinkSelfContainedDefault::InferredForMingw => {
+ sess.host == sess.target
+ && sess.target.vendor != "uwp"
+diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
+index 5117cadbee0e6..36d64059d59ad 100644
+--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
++++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
+@@ -1,13 +1,9 @@
+-use crate::spec::crt_objects;
+-use crate::spec::{base, LinkSelfContainedDefault, TargetOptions};
++use crate::spec::{base, TargetOptions};
+
+ pub fn opts() -> TargetOptions {
+ let mut base = base::linux::opts();
+
+ base.env = "musl".into();
+- base.pre_link_objects_self_contained = crt_objects::pre_musl_self_contained();
+- base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
+- base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
+
+ // These targets statically link libc by default
+ base.crt_static_default = true;
+diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs
+index 53f710b8f9e14..2a4eec15f2027 100644
+--- a/compiler/rustc_target/src/spec/crt_objects.rs
++++ b/compiler/rustc_target/src/spec/crt_objects.rs
+@@ -61,28 +61,6 @@ pub(super) fn all(obj: &'static str) -> CrtObjects {
+ ])
+ }
+
+-pub(super) fn pre_musl_self_contained() -> CrtObjects {
+- new(&[
+- (LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
+- (LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o", "crtbeginS.o"]),
+- (LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]),
+- (LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o", "crtbeginS.o"]),
+- (LinkOutputKind::DynamicDylib, &["crti.o", "crtbeginS.o"]),
+- (LinkOutputKind::StaticDylib, &["crti.o", "crtbeginS.o"]),
+- ])
+-}
+-
+-pub(super) fn post_musl_self_contained() -> CrtObjects {
+- new(&[
+- (LinkOutputKind::DynamicNoPicExe, &["crtend.o", "crtn.o"]),
+- (LinkOutputKind::DynamicPicExe, &["crtendS.o", "crtn.o"]),
+- (LinkOutputKind::StaticNoPicExe, &["crtend.o", "crtn.o"]),
+- (LinkOutputKind::StaticPicExe, &["crtendS.o", "crtn.o"]),
+- (LinkOutputKind::DynamicDylib, &["crtendS.o", "crtn.o"]),
+- (LinkOutputKind::StaticDylib, &["crtendS.o", "crtn.o"]),
+- ])
+-}
+-
+ pub(super) fn pre_mingw_self_contained() -> CrtObjects {
+ new(&[
+ (LinkOutputKind::DynamicNoPicExe, &["crt2.o", "rsbegin.o"]),
+diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
+index 941d767b850dc..1ce8e0e64e4c7 100644
+--- a/compiler/rustc_target/src/spec/mod.rs
++++ b/compiler/rustc_target/src/spec/mod.rs
+@@ -549,9 +549,6 @@ pub enum LinkSelfContainedDefault {
+ /// The target spec explicitly disables self-contained linking.
+ False,
+
+- /// The target spec requests that the self-contained mode is inferred, in the context of musl.
+- InferredForMusl,
+-
+ /// The target spec requests that the self-contained mode is inferred, in the context of mingw.
+ InferredForMingw,
+
+@@ -568,7 +565,6 @@ impl FromStr for LinkSelfContainedDefault {
+ Ok(match s {
+ "false" => LinkSelfContainedDefault::False,
+ "true" | "wasm" => LinkSelfContainedDefault::True,
+- "musl" => LinkSelfContainedDefault::InferredForMusl,
+ "mingw" => LinkSelfContainedDefault::InferredForMingw,
+ _ => return Err(()),
+ })
+@@ -590,7 +586,6 @@ impl ToJson for LinkSelfContainedDefault {
+ // Stable backwards-compatible values
+ LinkSelfContainedDefault::True => "true".to_json(),
+ LinkSelfContainedDefault::False => "false".to_json(),
+- LinkSelfContainedDefault::InferredForMusl => "musl".to_json(),
+ LinkSelfContainedDefault::InferredForMingw => "mingw".to_json(),
+ }
+ }
+diff --git a/config.example.toml b/config.example.toml
+index f94553dd63f72..687a79bdd3ccc 100644
+--- a/config.example.toml
++++ b/config.example.toml
+@@ -592,14 +592,6 @@
+ # behavior -- this may lead to miscompilations or other bugs.
+ #description = ""
+
+-# The root location of the musl installation directory. The library directory
+-# will also need to contain libunwind.a for an unwinding implementation. Note
+-# that this option only makes sense for musl targets that produce statically
+-# linked binaries.
+-#
+-# Defaults to /usr on musl hosts. Has no default otherwise.
+-#musl-root = <platform specific> (path)
+-
+ # By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix
+ # platforms to ensure that the compiler is usable by default from the build
+ # directory (as it links to a number of dynamic libraries). This may not be
+@@ -835,15 +827,6 @@
+ # only use static libraries. If unset, the target's default linkage is used.
+ #crt-static = <platform-specific> (bool)
+
+-# The root location of the musl installation directory. The library directory
+-# will also need to contain libunwind.a for an unwinding implementation. Note
+-# that this option only makes sense for musl targets that produce statically
+-# linked binaries.
+-#musl-root = build.musl-root (path)
+-
+-# The full path to the musl libdir.
+-#musl-libdir = musl-root/lib
+-
+ # The root location of the `wasm32-wasip1` sysroot. Only used for WASI
+ # related targets. Make sure to create a `[target.wasm32-wasip1]`
+ # section and move this field there (or equivalent for the target being built).
+diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
+index 818a7daadcab8..a7331009faf82 100755
+--- a/src/bootstrap/configure.py
++++ b/src/bootstrap/configure.py
+@@ -99,40 +99,6 @@ def v(*args):
+ v("llvm-filecheck", None, "set path to LLVM's FileCheck utility")
+ v("python", "build.python", "set path to python")
+ v("android-ndk", "build.android-ndk", "set path to Android NDK")
+-v("musl-root", "target.x86_64-unknown-linux-musl.musl-root",
+- "MUSL root installation directory (deprecated)")
+-v("musl-root-x86_64", "target.x86_64-unknown-linux-musl.musl-root",
+- "x86_64-unknown-linux-musl install directory")
+-v("musl-root-i586", "target.i586-unknown-linux-musl.musl-root",
+- "i586-unknown-linux-musl install directory")
+-v("musl-root-i686", "target.i686-unknown-linux-musl.musl-root",
+- "i686-unknown-linux-musl install directory")
+-v("musl-root-arm", "target.arm-unknown-linux-musleabi.musl-root",
+- "arm-unknown-linux-musleabi install directory")
+-v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
+- "arm-unknown-linux-musleabihf install directory")
+-v("musl-root-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root",
+- "armv5te-unknown-linux-musleabi install directory")
+-v("musl-root-armv7", "target.armv7-unknown-linux-musleabi.musl-root",
+- "armv7-unknown-linux-musleabi install directory")
+-v("musl-root-armv7hf", "target.armv7-unknown-linux-musleabihf.musl-root",
+- "armv7-unknown-linux-musleabihf install directory")
+-v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
+- "aarch64-unknown-linux-musl install directory")
+-v("musl-root-mips", "target.mips-unknown-linux-musl.musl-root",
+- "mips-unknown-linux-musl install directory")
+-v("musl-root-mipsel", "target.mipsel-unknown-linux-musl.musl-root",
+- "mipsel-unknown-linux-musl install directory")
+-v("musl-root-mips64", "target.mips64-unknown-linux-muslabi64.musl-root",
+- "mips64-unknown-linux-muslabi64 install directory")
+-v("musl-root-mips64el", "target.mips64el-unknown-linux-muslabi64.musl-root",
+- "mips64el-unknown-linux-muslabi64 install directory")
+-v("musl-root-riscv32gc", "target.riscv32gc-unknown-linux-musl.musl-root",
+- "riscv32gc-unknown-linux-musl install directory")
+-v("musl-root-riscv64gc", "target.riscv64gc-unknown-linux-musl.musl-root",
+- "riscv64gc-unknown-linux-musl install directory")
+-v("musl-root-loongarch64", "target.loongarch64-unknown-linux-musl.musl-root",
+- "loongarch64-unknown-linux-musl install directory")
+ v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
+ "rootfs in qemu testing, you probably don't want to use this")
+ v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
+diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
+index e927b491c71ea..b77e1a1598f12 100644
+--- a/src/bootstrap/src/core/build_steps/compile.rs
++++ b/src/bootstrap/src/core/build_steps/compile.rs
+@@ -362,38 +362,7 @@ fn copy_self_contained_objects(
+
+ // Copies the libc and CRT objects.
+ //
+- // rustc historically provides a more self-contained installation for musl targets
+- // not requiring the presence of a native musl toolchain. For example, it can fall back
+- // to using gcc from a glibc-targeting toolchain for linking.
+- // To do that we have to distribute musl startup objects as a part of Rust toolchain
+- // and link with them manually in the self-contained mode.
+- if target.contains("musl") && !target.contains("unikraft") {
+- let srcdir = builder.musl_libdir(target).unwrap_or_else(|| {
+- panic!("Target {:?} does not have a \"musl-libdir\" key", target.triple)
+- });
+- for &obj in &["libc.a", "crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
+- copy_and_stamp(
+- builder,
+- &libdir_self_contained,
+- &srcdir,
+- obj,
+- &mut target_deps,
+- DependencyType::TargetSelfContained,
+- );
+- }
+- let crt_path = builder.ensure(llvm::CrtBeginEnd { target });
+- for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] {
+- let src = crt_path.join(obj);
+- let target = libdir_self_contained.join(obj);
+- builder.copy_link(&src, &target);
+- target_deps.push((target, DependencyType::TargetSelfContained));
+- }
+-
+- if !target.starts_with("s390x") {
+- let libunwind_path = copy_llvm_libunwind(builder, target, &libdir_self_contained);
+- target_deps.push((libunwind_path, DependencyType::TargetSelfContained));
+- }
+- } else if target.contains("-wasi") {
++ if target.contains("-wasi") {
+ let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
+ panic!(
+ "Target {:?} does not have a \"wasi-root\" key in Config.toml \
+@@ -501,15 +470,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
+ .arg("--manifest-path")
+ .arg(builder.src.join("library/sysroot/Cargo.toml"));
+
+- // Help the libc crate compile by assisting it in finding various
+- // sysroot native libraries.
+- if target.contains("musl") {
+- if let Some(p) = builder.musl_libdir(target) {
+- let root = format!("native={}", p.to_str().unwrap());
+- cargo.rustflag("-L").rustflag(&root);
+- }
+- }
+-
+ if target.contains("-wasi") {
+ if let Some(dir) = builder.wasi_libdir(target) {
+ let root = format!("native={}", dir.to_str().unwrap());
+--- rustc-beta-src/src/bootstrap/src/core/config/config.rs.old 2024-07-24 20:53:57.000000000 -0500
++++ rustc-beta-src/src/bootstrap/src/core/config/config.rs 2024-07-30 13:14:50.152439530 -0500
+@@ -313,8 +313,6 @@
+ pub print_step_timings: bool,
+ pub print_step_rusage: bool,
+
+- // Fallback musl-root for all targets
+- pub musl_root: Option<PathBuf>,
+ pub prefix: Option<PathBuf>,
+ pub sysconfdir: Option<PathBuf>,
+ pub datadir: Option<PathBuf>,
+@@ -558,8 +556,6 @@
+ pub profiler: Option<StringOrBool>,
+ pub rpath: Option<bool>,
+ pub crt_static: Option<bool>,
+- pub musl_root: Option<PathBuf>,
+- pub musl_libdir: Option<PathBuf>,
+ pub wasi_root: Option<PathBuf>,
+ pub qemu_rootfs: Option<PathBuf>,
+ pub runner: Option<String>,
+@@ -1079,7 +1075,6 @@
+ default_linker: Option<String> = "default-linker",
+ channel: Option<String> = "channel",
+ description: Option<String> = "description",
+- musl_root: Option<String> = "musl-root",
+ rpath: Option<bool> = "rpath",
+ strip: Option<bool> = "strip",
+ frame_pointers: Option<bool> = "frame-pointers",
+@@ -1133,8 +1128,6 @@
+ profiler: Option<StringOrBool> = "profiler",
+ rpath: Option<bool> = "rpath",
+ crt_static: Option<bool> = "crt-static",
+- musl_root: Option<String> = "musl-root",
+- musl_libdir: Option<String> = "musl-libdir",
+ wasi_root: Option<String> = "wasi-root",
+ qemu_rootfs: Option<String> = "qemu-rootfs",
+ no_std: Option<bool> = "no-std",
+@@ -1599,7 +1592,6 @@
+ default_linker,
+ channel,
+ description,
+- musl_root,
+ rpath,
+ verbose_tests,
+ optimize_tests,
+@@ -1687,7 +1679,6 @@
+ config.rustc_parallel =
+ parallel_compiler.unwrap_or(config.channel == "dev" || config.channel == "nightly");
+ config.rustc_default_linker = default_linker;
+- config.musl_root = musl_root.map(PathBuf::from);
+ config.save_toolstates = save_toolstates.map(PathBuf::from);
+ set(
+ &mut config.deny_warnings,
+@@ -1906,8 +1897,6 @@
+ target.ranlib = cfg.ranlib.map(PathBuf::from);
+ target.linker = cfg.linker.map(PathBuf::from);
+ target.crt_static = cfg.crt_static;
+- target.musl_root = cfg.musl_root.map(PathBuf::from);
+- target.musl_libdir = cfg.musl_libdir.map(PathBuf::from);
+ target.wasi_root = cfg.wasi_root.map(PathBuf::from);
+ target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from);
+ target.runner = cfg.runner;
+@@ -2667,7 +2656,6 @@
+ split_debuginfo: _,
+ backtrace: _,
+ parallel_compiler: _,
+- musl_root: _,
+ verbose_tests: _,
+ optimize_tests: _,
+ codegen_tests: _,
+diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
+index e03b1e179084e..e61335d9b46c1 100644
+--- a/src/bootstrap/src/core/sanity.rs
++++ b/src/bootstrap/src/core/sanity.rs
+@@ -11,7 +11,6 @@
+ use std::collections::HashMap;
+ use std::env;
+ use std::ffi::{OsStr, OsString};
+-use std::fs;
+ use std::path::PathBuf;
+ use std::process::Command;
+
+@@ -323,28 +322,6 @@ than building it.
+ continue;
+ }
+
+- // Make sure musl-root is valid.
+- if target.contains("musl") && !target.contains("unikraft") {
+- // If this is a native target (host is also musl) and no musl-root is given,
+- // fall back to the system toolchain in /usr before giving up
+- if build.musl_root(*target).is_none() && build.config.build == *target {
+- let target = build.config.target_config.entry(*target).or_default();
+- target.musl_root = Some("/usr".into());
+- }
+- match build.musl_libdir(*target) {
+- Some(libdir) => {
+- if fs::metadata(libdir.join("libc.a")).is_err() {
+- panic!("couldn't find libc.a in musl libdir: {}", libdir.display());
+- }
+- }
+- None => panic!(
+- "when targeting MUSL either the rust.musl-root \
+- option or the target.$TARGET.musl-root option must \
+- be specified in config.toml"
+- ),
+- }
+- }
+-
+ if need_cmake && target.is_msvc() {
+ // There are three builds of cmake on windows: MSVC, MinGW, and
+ // Cygwin. The Cygwin build does not have generators for Visual
+diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
+index 30d775f774ce7..23145199b4bbb 100644
+--- a/src/bootstrap/src/lib.rs
++++ b/src/bootstrap/src/lib.rs
+@@ -1365,25 +1365,6 @@ impl Build {
+ }
+ }
+
+- /// Returns the "musl root" for this `target`, if defined
+- fn musl_root(&self, target: TargetSelection) -> Option<&Path> {
+- self.config
+- .target_config
+- .get(&target)
+- .and_then(|t| t.musl_root.as_ref())
+- .or(self.config.musl_root.as_ref())
+- .map(|p| &**p)
+- }
+-
+- /// Returns the "musl libdir" for this `target`.
+- fn musl_libdir(&self, target: TargetSelection) -> Option<PathBuf> {
+- let t = self.config.target_config.get(&target)?;
+- if let libdir @ Some(_) = &t.musl_libdir {
+- return libdir.clone();
+- }
+- self.musl_root(target).map(|root| root.join("lib"))
+- }
+-
+ /// Returns the `lib` directory for the WASI target specified, if
+ /// configured.
+ ///
+diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs
+index 3ba4e0cb686e6..33dba449dee2a 100644
+--- a/src/bootstrap/src/utils/cc_detect.rs
++++ b/src/bootstrap/src/utils/cc_detect.rs
+@@ -41,7 +41,7 @@ fn cc2ar(cc: &Path, target: TargetSelection) -> Option<PathBuf> {
+ Some(PathBuf::from(ar))
+ } else if target.is_msvc() {
+ None
+- } else if target.contains("musl") || target.contains("openbsd") {
++ } else if target.contains("openbsd") {
+ Some(PathBuf::from("ar"))
+ } else if target.contains("vxworks") {
+ Some(PathBuf::from("wr-ar"))
+@@ -197,30 +197,6 @@ fn default_compiler(
+ }
+ }
+
+- "mips-unknown-linux-musl" if compiler == Language::C => {
+- if cfg.get_compiler().path().to_str() == Some("gcc") {
+- Some(PathBuf::from("mips-linux-musl-gcc"))
+- } else {
+- None
+- }
+- }
+- "mipsel-unknown-linux-musl" if compiler == Language::C => {
+- if cfg.get_compiler().path().to_str() == Some("gcc") {
+- Some(PathBuf::from("mipsel-linux-musl-gcc"))
+- } else {
+- None
+- }
+- }
+-
+- t if t.contains("musl") && compiler == Language::C => {
+- if let Some(root) = build.musl_root(target) {
+- let guess = root.join("bin/musl-gcc");
+- if guess.exists() { Some(guess) } else { None }
+- } else {
+- None
+- }
+- }
+-
+ t if t.contains("-wasi") => {
+ let root = PathBuf::from(std::env::var_os("WASI_SDK_PATH")?);
+ let compiler = match compiler {
+diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile
+index 420c42bc9d807..83ff773c08e1a 100644
+--- a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile
++++ b/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile
+@@ -36,7 +36,6 @@ ENV HOSTS=arm-unknown-linux-gnueabi,aarch64-unknown-linux-musl
+ ENV RUST_CONFIGURE_ARGS \
+ --enable-full-tools \
+ --disable-docs \
+- --musl-root-aarch64=/usr/local/aarch64-linux-musl \
+ --enable-sanitizers \
+ --enable-profiler \
+ --set target.aarch64-unknown-linux-musl.crt-static=false
+diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile
+index a62f98b21d225..f949736e866c4 100644
+--- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile
++++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile
+@@ -58,8 +58,6 @@ COPY scripts/sccache.sh /scripts/
+ RUN sh /scripts/sccache.sh
+
+ ENV RUST_CONFIGURE_ARGS \
+- --musl-root-i586=/musl-i586 \
+- --musl-root-i686=/musl-i686 \
+ --disable-docs
+
+ # Newer binutils broke things on some vms/distros (i.e., linking against
+diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile
+index 09fbbac466c72..1ab841763db19 100644
+--- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile
++++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile
+@@ -154,10 +154,6 @@ ENV CFLAGS_armv5te_unknown_linux_musleabi="-march=armv5te -marm -mfloat-abi=soft
+ CC_x86_64_pc_windows_gnullvm=x86_64-w64-mingw32-clang
+
+ ENV RUST_CONFIGURE_ARGS \
+- --musl-root-armv5te=/musl-armv5te \
+- --musl-root-arm=/musl-arm \
+- --musl-root-armhf=/musl-armhf \
+- --musl-root-armv7hf=/musl-armv7hf \
+ --disable-docs
+
+ ENV SCRIPT \
+diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
+index 9b15bb3530b61..d15d69e4fee47 100644
+--- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
++++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
+@@ -134,6 +134,5 @@ RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm
+ RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm
+
+-ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs \
++ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs
+- --musl-root-armv7=/musl-armv7
+
+ ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS
+diff --git a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile
+index c9a6a2dd069e2..30eda009dee30 100644
+--- a/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile
++++ b/src/ci/docker/host-x86_64/dist-x86_64-musl/Dockerfile
+@@ -35,7 +35,6 @@ RUN sh /scripts/sccache.sh
+ ENV HOSTS=x86_64-unknown-linux-musl
+
+ ENV RUST_CONFIGURE_ARGS \
+- --musl-root-x86_64=/usr/local/x86_64-linux-musl \
+ --enable-extended \
+ --enable-sanitizers \
+ --enable-profiler \
+diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile
+index 944d9aed3190b..b0ffa7c0e316e 100644
+--- a/src/ci/docker/host-x86_64/test-various/Dockerfile
++++ b/src/ci/docker/host-x86_64/test-various/Dockerfile
+@@ -45,7 +45,6 @@ COPY host-x86_64/dist-various-2/build-wasi-toolchain.sh /tmp/
+ ENV WASI_SDK_PATH=/wasi-sdk-22.0
+
+ ENV RUST_CONFIGURE_ARGS \
+- --musl-root-x86_64=/usr/local/x86_64-linux-musl \
+ --set rust.lld
+
+ # Some run-make tests have assertions about code size, and enabling debug
diff --git a/experimental/rust-beta/0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch b/experimental/rust-beta/0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch
new file mode 100644
index 000000000..cbb22cd45
--- /dev/null
+++ b/experimental/rust-beta/0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch
@@ -0,0 +1,25 @@
+From 78ae73f09d07c847ede1dc683b8907f5bd5bd17f Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sat, 9 Sep 2017 00:14:16 -0500
+Subject: [PATCH 05/12] Prefer libgcc_eh over libunwind for musl
+
+---
+ library/unwind/src/lib.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs
+index 079626f0fea..590fca0acfa 100644
+--- a/library/unwind/src/lib.rs
++++ b/library/unwind/src/lib.rs
+@@ -63,7 +63,7 @@
+ #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
+ extern "C" {}
+ } else {
+- #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
++ #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
+ #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
+ extern "C" {}
+ }
+--
+2.35.1
+
diff --git a/experimental/rust-beta/0006-Link-libssp_nonshared.a-on-all-musl-targets.patch b/experimental/rust-beta/0006-Link-libssp_nonshared.a-on-all-musl-targets.patch
new file mode 100644
index 000000000..d34bb560d
--- /dev/null
+++ b/experimental/rust-beta/0006-Link-libssp_nonshared.a-on-all-musl-targets.patch
@@ -0,0 +1,28 @@
+From f516ef748075ddfbcbaec493e1a7ee1e59538bd0 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Nov 2019 17:01:32 -0600
+Subject: [PATCH 06/12] Link libssp_nonshared.a on all musl targets
+
+---
+ compiler/rustc_target/src/spec/base/linux_musl.rs | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
+index 36d64059d59ad..c113af2464423 100644
+--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
++++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
+@@ -1,10 +1,13 @@
+-use crate::spec::{base, TargetOptions};
++use crate::spec::{add_link_args, base, Cc, LinkerFlavor, Lld, TargetOptions};
+
+ pub fn opts() -> TargetOptions {
+ let mut base = base::linux::opts();
+
+ base.env = "musl".into();
+
++ // libssp_nonshared.a is needed for __stack_chk_fail_local when using libc.so
++ add_link_args(&mut base.post_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-lssp_nonshared"]);
++
+ // These targets statically link libc by default
+ base.crt_static_default = true;
+
diff --git a/experimental/rust-beta/0007-test-failed-doctest-output-Fix-normalization.patch b/experimental/rust-beta/0007-test-failed-doctest-output-Fix-normalization.patch
new file mode 100644
index 000000000..9dfada04f
--- /dev/null
+++ b/experimental/rust-beta/0007-test-failed-doctest-output-Fix-normalization.patch
@@ -0,0 +1,31 @@
+From 5ecc3bac493f2df5b76f42cff6ea602d1624d323 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Mon, 7 Oct 2019 18:36:28 -0500
+Subject: [PATCH 07/12] test/failed-doctest-output: Fix normalization
+
+Otherwise we get:
+
+1
+2 running 2 tests
+- test $DIR/failed-doctest-output.rs - OtherStruct (line 20) ... FAILED
+- test $DIR/failed-doctest-output.rs - SomeStruct (line 10) ... FAILED
++ test src/rustc-1.38.0-src/$DIR/failed-doctest-output.rs - OtherStruct (line 20) ... FAILED
++ test src/rustc-1.38.0-src/$DIR/failed-doctest-output.rs - SomeStruct (line 10) ... FAILED
+5
+6 failures:
+7
+---
+ tests/rustdoc-ui/doctest/failed-doctest-output.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output.rs b/tests/rustdoc-ui/doctest/failed-doctest-output.rs
+index d4d49b73793e6..9c44f7ce23281 100644
+--- a/tests/rustdoc-ui/doctest/failed-doctest-output.rs
++++ b/tests/rustdoc-ui/doctest/failed-doctest-output.rs
+@@ -8,5 +8,5 @@
+ //@ compile-flags:--test --test-args --test-threads=1
+ //@ rustc-env:RUST_BACKTRACE=0
+-//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
++//@ normalize-stdout-test: "[[:graph:]]*tests/rustdoc-ui/doctest" -> "$$DIR"
+ //@ normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
+ //@ failure-status: 101
diff --git a/experimental/rust-beta/0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch b/experimental/rust-beta/0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
new file mode 100644
index 000000000..43f0f37f2
--- /dev/null
+++ b/experimental/rust-beta/0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
@@ -0,0 +1,22 @@
+From cf671a6f53fe74b02aa48c0206d48506d6cdd7cd Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Mon, 17 Sep 2018 01:32:20 +0000
+Subject: [PATCH 08/12] test/sysroot-crates-are-unstable: Fix test when rpath is
+ disabled
+
+Without this environment var, the test can't run rustc to find
+the sysroot path.
+---
+ tests/run-make/sysroot-crates-are-unstable/Makefile | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/run-make/sysroot-crates-are-unstable/Makefile b/tests/run-make/sysroot-crates-are-unstable/Makefile
+index 1e267fb9576ba..30c33c5c13d20 100644
+--- a/tests/run-make/sysroot-crates-are-unstable/Makefile
++++ b/tests/run-make/sysroot-crates-are-unstable/Makefile
+@@ -1,2 +1,4 @@
++-include ../tools.mk
++
+ all:
+- '$(PYTHON)' test.py
++ env '$(HOST_RPATH_ENV)' '$(PYTHON)' test.py
diff --git a/experimental/rust-beta/0009-Ignore-broken-and-non-applicable-tests.patch b/experimental/rust-beta/0009-Ignore-broken-and-non-applicable-tests.patch
new file mode 100644
index 000000000..b8b1b8932
--- /dev/null
+++ b/experimental/rust-beta/0009-Ignore-broken-and-non-applicable-tests.patch
@@ -0,0 +1,47 @@
+From cc6d3d3ab26517d5f8f09536b016154944bdceff Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 16 Sep 2018 16:38:48 +0000
+Subject: [PATCH 09/12] Ignore broken and non-applicable tests
+
+env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox)
+long-linker-command-lines: takes >10 minutes to run (but still passes)
+sysroot-crates-are-unstable: can't run rustc without RPATH
+---
+ tests/run-make/long-linker-command-lines/Makefile | 2 ++
+ tests/run-make/sysroot-crates-are-unstable/Makefile | 2 ++
+ tests/ui/process/env-funky-keys.rs | 1 +
+ 3 files changed, 7 insertions(+)
+
+diff --git a/tests/run-make/long-linker-command-lines/Makefile b/tests/run-make/long-linker-command-lines/Makefile
+index f864ea74f4a95..f16eaf544cc3f 100644
+--- a/tests/run-make/long-linker-command-lines/Makefile
++++ b/tests/run-make/long-linker-command-lines/Makefile
+@@ -1,4 +1,6 @@
+ # ignore-cross-compile
++# ignore-test
++
+ include ../tools.mk
+
+ export LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
+diff --git a/tests/run-make/sysroot-crates-are-unstable/Makefile b/tests/run-make/sysroot-crates-are-unstable/Makefile
+index 30c33c5c13d20..d733bb1c557f5 100644
+--- a/tests/run-make/sysroot-crates-are-unstable/Makefile
++++ b/tests/run-make/sysroot-crates-are-unstable/Makefile
+@@ -1,3 +1,5 @@
++# ignore-test
++
+ -include ../tools.mk
+
+ all:
+diff --git a/tests/ui/env-funky-keys.rs b/tests/ui/env-funky-keys.rs
+index 314ccaea01525..7f5b9efaa10b1 100644
+--- a/tests/ui/process/env-funky-keys.rs
++++ b/tests/ui/process/env-funky-keys.rs
+@@ -1,6 +1,7 @@
+ //@ run-pass
+ // Ignore this test on Android, because it segfaults there.
+
++//@ ignore-test
+ //@ ignore-android
+ //@ ignore-windows
+ //@ ignore-wasm32 no execve
diff --git a/experimental/rust-beta/0010-Link-stage-2-tools-dynamically-to-libstd.patch b/experimental/rust-beta/0010-Link-stage-2-tools-dynamically-to-libstd.patch
new file mode 100644
index 000000000..372948d85
--- /dev/null
+++ b/experimental/rust-beta/0010-Link-stage-2-tools-dynamically-to-libstd.patch
@@ -0,0 +1,22 @@
+From 4443dc788cea90bdb1f9e5f3d9b702a3be46d4ed Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Mon, 24 Sep 2018 23:42:23 +0000
+Subject: [PATCH 10/12] Link stage 2 tools dynamically to libstd
+
+---
+ src/bootstrap/src/core/builder.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
+index cd276674dee6b..a16297b4fe6cc 100644
+--- a/src/bootstrap/src/core/builder.rs
++++ b/src/bootstrap/src/core/builder.rs
+@@ -2146,7 +2146,7 @@ impl<'a> Builder<'a> {
+ // When we build Rust dylibs they're all intended for intermediate
+ // usage, so make sure we pass the -Cprefer-dynamic flag instead of
+ // linking all deps statically into the dylib.
+- if matches!(mode, Mode::Std | Mode::Rustc) {
++ if matches!(mode, Mode::Std | Mode::Rustc | Mode::ToolRustc) {
+ rustflags.arg("-Cprefer-dynamic");
+ }
+
diff --git a/experimental/rust-beta/0011-Move-debugger-scripts-to-usr-share-rust.patch b/experimental/rust-beta/0011-Move-debugger-scripts-to-usr-share-rust.patch
new file mode 100644
index 000000000..604e223e8
--- /dev/null
+++ b/experimental/rust-beta/0011-Move-debugger-scripts-to-usr-share-rust.patch
@@ -0,0 +1,66 @@
+From 762d3cd3f87b7fdbb885e1bcd4d1314437dd9377 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Mon, 17 Sep 2018 02:09:10 +0000
+Subject: [PATCH 11/12] Move debugger scripts to /usr/share/rust
+
+---
+ src/bootstrap/dist.rs | 2 +-
+ src/etc/rust-gdb | 2 +-
+ src/etc/rust-gdbgui | 2 +-
+ src/etc/rust-lldb | 4 ++--
+ 4 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
+index 76aad16c1fc26..db53459e8cae4 100644
+--- a/src/bootstrap/src/core/build_steps/dist.rs
++++ b/src/bootstrap/src/core/build_steps/dist.rs
+@@ -521,7 +521,7 @@ impl Step for DebuggerScripts {
+ fn run(self, builder: &Builder<'_>) {
+ let host = self.host;
+ let sysroot = self.sysroot;
+- let dst = sysroot.join("lib/rustlib/etc");
++ let dst = sysroot.join("share/rust");
+ t!(fs::create_dir_all(&dst));
+ let cp_debugger_script = |file: &str| {
+ builder.install(&builder.src.join("src/etc/").join(file), &dst, 0o644);
+diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb
+index 9abed30ea6f73..4c7f953edfa46 100755
+--- a/src/etc/rust-gdb
++++ b/src/etc/rust-gdb
+@@ -12,7 +12,7 @@ fi
+
+ # Find out where the pretty printer Python module is
+ RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
+-GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
++GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust"
+ # Get the commit hash for path remapping
+ RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')"
+
+diff --git a/src/etc/rust-gdbgui b/src/etc/rust-gdbgui
+index 913269316bd4c..f444fbc4b104e 100755
+--- a/src/etc/rust-gdbgui
++++ b/src/etc/rust-gdbgui
+@@ -41,7 +41,7 @@ fi
+
+ # Find out where the pretty printer Python module is
+ RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
+-GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
++GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust"
+ # Get the commit hash for path remapping
+ RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')"
+
+diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb
+index bce72f1bad698..8abb012452787 100755
+--- a/src/etc/rust-lldb
++++ b/src/etc/rust-lldb
+@@ -30,8 +30,8 @@ EOF
+ fi
+ fi
+
+-script_import="command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_lookup.py\""
+-commands_file="$RUSTC_SYSROOT/lib/rustlib/etc/lldb_commands"
++script_import="command script import \"$RUSTC_SYSROOT/share/rust/lldb_lookup.py\""
++commands_file="$RUSTC_SYSROOT/share/rust/lldb_commands"
+
+ # Call LLDB with the commands added to the argument list
+ exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@"
diff --git a/experimental/rust-beta/0012-Add-foxkit-target-specs.patch b/experimental/rust-beta/0012-Add-foxkit-target-specs.patch
new file mode 100644
index 000000000..0303369ed
--- /dev/null
+++ b/experimental/rust-beta/0012-Add-foxkit-target-specs.patch
@@ -0,0 +1,206 @@
+From 7e50215a21b198c73fe575d28c847fd645c4ee40 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Mon, 17 Sep 2018 02:29:06 +0000
+Subject: [PATCH 12/12] Add foxkit target specs
+
+---
+ .../src/spec/targets/aarch64_foxkit_linux_musl.rs | 11 +++++++++++
+ .../src/spec/targets/armv7_foxkit_linux_musleabihf.rs | 11 +++++++++++
+ .../rustc_target/src/spec/targets/i586_foxkit_linux_musl.rs | 11 +++++++++++
+ compiler/rustc_target/src/spec/mod.rs | 7 +++++++
+ .../src/spec/targets/powerpc64_foxkit_linux_musl.rs | 11 +++++++++++
+ .../src/spec/targets/powerpc_foxkit_linux_musl.rs | 11 +++++++++++
+ .../rustc_target/src/spec/targets/x86_64_foxkit_linux_musl.rs | 11 +++++++++++
+ 7 files changed, 73 insertions(+)
+ create mode 100644 compiler/rustc_target/src/spec/targets/aarch64_foxkit_linux_musl.rs
+ create mode 100644 compiler/rustc_target/src/spec/targets/armv7_foxkit_linux_musleabihf.rs
+ create mode 100644 compiler/rustc_target/src/spec/targets/i586_foxkit_linux_musl.rs
+ create mode 100644 compiler/rustc_target/src/spec/targets/powerpc64_foxkit_linux_musl.rs
+ create mode 100644 compiler/rustc_target/src/spec/targets/powerpc_foxkit_linux_musl.rs
+ create mode 100644 compiler/rustc_target/src/spec/targets/x86_64_foxkit_linux_musl.rs
+
+diff --git a/compiler/rustc_target/src/spec/targets/aarch64_foxkit_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_foxkit_linux_musl.rs
+new file mode 100644
+index 00000000000..4bdd51af4fe
+--- /dev/null
++++ b/compiler/rustc_target/src/spec/targets/aarch64_foxkit_linux_musl.rs
+@@ -0,0 +1,11 @@
++use crate::spec::Target;
++
++pub fn target() -> Target {
++ let mut base = super::aarch64_unknown_linux_musl::target();
++
++ base.llvm_target = "aarch64-foxkit-linux-musl".into();
++ base.vendor = "foxkit".into();
++ base.options.crt_static_default = false;
++
++ base
++}
+diff --git a/compiler/rustc_target/src/spec/targets/armv7_foxkit_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_foxkit_linux_musleabihf.rs
+new file mode 100644
+index 00000000000..994f3c39e7c
+--- /dev/null
++++ b/compiler/rustc_target/src/spec/targets/armv7_foxkit_linux_musleabihf.rs
+@@ -0,0 +1,11 @@
++use crate::spec::Target;
++
++pub fn target() -> Target {
++ let mut base = super::armv7_unknown_linux_musleabihf::target();
++
++ base.llvm_target = "armv7-foxkit-linux-musleabihf".into();
++ base.vendor = "foxkit".into();
++ base.options.crt_static_default = false;
++
++ base
++}
+diff --git a/compiler/rustc_target/src/spec/targets/i586_foxkit_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i586_foxkit_linux_musl.rs
+new file mode 100644
+index 00000000000..028e4b5e930
+--- /dev/null
++++ b/compiler/rustc_target/src/spec/targets/i586_foxkit_linux_musl.rs
+@@ -0,0 +1,11 @@
++use crate::spec::Target;
++
++pub fn target() -> Target {
++ let mut base = super::i586_unknown_linux_musl::target();
++
++ base.llvm_target = "i586-foxkit-linux-musl".into();
++ base.vendor = "foxkit".into();
++ base.options.crt_static_default = false;
++
++ base
++}
+diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
+index 92678aed5b1..66a408d0b36 100644
+--- a/compiler/rustc_target/src/spec/mod.rs
++++ b/compiler/rustc_target/src/spec/mod.rs
+@@ -1533,6 +1533,13 @@ fn $module() {
+ }
+
+ supported_targets! {
++ ("aarch64-foxkit-linux-musl", aarch64_foxkit_linux_musl),
++ ("armv7-foxkit-linux-musleabihf", armv7_foxkit_linux_musleabihf),
++ ("i586-foxkit-linux-musl", i586_foxkit_linux_musl),
++ ("powerpc-foxkit-linux-musl", powerpc_foxkit_linux_musl),
++ ("powerpc64-foxkit-linux-musl", powerpc64_foxkit_linux_musl),
++ ("x86_64-foxkit-linux-musl", x86_64_foxkit_linux_musl),
++
+ ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
+ ("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
+ ("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
+diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_foxkit_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_foxkit_linux_musl.rs
+new file mode 100644
+index 00000000000..04a50f84b60
+--- /dev/null
++++ b/compiler/rustc_target/src/spec/targets/powerpc64_foxkit_linux_musl.rs
+@@ -0,0 +1,11 @@
++use crate::spec::Target;
++
++pub fn target() -> Target {
++ let mut base = super::powerpc64_unknown_linux_musl::target();
++
++ base.llvm_target = "powerpc64-foxkit-linux-musl".into();
++ base.vendor = "foxkit".into();
++ base.options.crt_static_default = false;
++
++ base
++}
+diff --git a/compiler/rustc_target/src/spec/targets/powerpc_foxkit_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_foxkit_linux_musl.rs
+new file mode 100644
+index 00000000000..7bca52c4299
+--- /dev/null
++++ b/compiler/rustc_target/src/spec/targets/powerpc_foxkit_linux_musl.rs
+@@ -0,0 +1,11 @@
++use crate::spec::Target;
++
++pub fn target() -> Target {
++ let mut base = super::powerpc_unknown_linux_musl::target();
++
++ base.llvm_target = "powerpc-foxkit-linux-musl".into();
++ base.vendor = "foxkit".into();
++ base.options.crt_static_default = false;
++
++ base
++}
+diff --git a/compiler/rustc_target/src/spec/targets/x86_64_foxkit_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_foxkit_linux_musl.rs
+new file mode 100644
+index 00000000000..1ff73687c00
+--- /dev/null
++++ b/compiler/rustc_target/src/spec/targets/x86_64_foxkit_linux_musl.rs
+@@ -0,0 +1,11 @@
++use crate::spec::Target;
++
++pub fn target() -> Target {
++ let mut base = super::x86_64_unknown_linux_musl::target();
++
++ base.llvm_target = "x86_64-foxkit-linux-musl".into();
++ base.vendor = "foxkit".into();
++ base.options.crt_static_default = false;
++
++ base
++}
+--
+2.35.1
+
+--- rustc-1.80.0-src/tests/assembly/targets/targets-elf.rs.old 2006-07-23 20:21:28.000000000 -0500
++++ rustc-1.80.0-src/tests/assembly/targets/targets-elf.rs 2024-07-30 09:49:06.031041198 -0500
+@@ -9,6 +9,9 @@
+ //@ revisions: aarch64_be_unknown_netbsd
+ //@ [aarch64_be_unknown_netbsd] compile-flags: --target aarch64_be-unknown-netbsd
+ //@ [aarch64_be_unknown_netbsd] needs-llvm-components: aarch64
++//@ revisions: aarch64_foxkit_linux_musl
++//@ [aarch64_foxkit_linux_musl] compile-flags: --target aarch64-foxkit-linux-musl
++//@ [aarch64_foxkit_linux_musl] needs-llvm-components: aarch64
+ //@ revisions: aarch64_fuchsia
+ //@ [aarch64_fuchsia] compile-flags: --target aarch64-fuchsia
+ //@ [aarch64_fuchsia] needs-llvm-components: aarch64
+@@ -120,6 +123,9 @@
+ //@ revisions: armv6k_nintendo_3ds
+ //@ [armv6k_nintendo_3ds] compile-flags: --target armv6k-nintendo-3ds
+ //@ [armv6k_nintendo_3ds] needs-llvm-components: arm
++//@ revisions: armv7_foxkit_linux_musleabihf
++//@ [armv7_foxkit_linux_musleabihf] compile-flags: --target armv7-foxkit-linux-musleabihf
++//@ [armv7_foxkit_linux_musleabihf] needs-llvm-components: arm
+ //@ revisions: armv7_linux_androideabi
+ //@ [armv7_linux_androideabi] compile-flags: --target armv7-linux-androideabi
+ //@ [armv7_linux_androideabi] needs-llvm-components: arm
+@@ -192,6 +198,9 @@
+ //@ revisions: hexagon_unknown_none_elf
+ //@ [hexagon_unknown_none_elf] compile-flags: --target hexagon-unknown-none-elf
+ //@ [hexagon_unknown_none_elf] needs-llvm-components: hexagon
++//@ revisions: i586_foxkit_linux_musl
++//@ [i586_foxkit_linux_musl] compile-flags: --target i586-foxkit-linux-musl
++//@ [i586_foxkit_linux_musl] needs-llvm-components: x86
+ //@ revisions: i586_pc_nto_qnx700
+ //@ [i586_pc_nto_qnx700] compile-flags: --target i586-pc-nto-qnx700
+ //@ [i586_pc_nto_qnx700] needs-llvm-components: x86
+@@ -309,6 +318,9 @@
+ //@ revisions: msp430_none_elf
+ //@ [msp430_none_elf] compile-flags: --target msp430-none-elf
+ //@ [msp430_none_elf] needs-llvm-components: msp430
++//@ revisions: powerpc64_foxkit_linux_musl
++//@ [powerpc64_foxkit_linux_musl] compile-flags: --target powerpc64-foxkit-linux-musl
++//@ [powerpc64_foxkit_linux_musl] needs-llvm-components: powerpc
+ //@ revisions: powerpc64_unknown_freebsd
+ //@ [powerpc64_unknown_freebsd] compile-flags: --target powerpc64-unknown-freebsd
+ //@ [powerpc64_unknown_freebsd] needs-llvm-components: powerpc
+@@ -333,6 +345,9 @@
+ //@ revisions: powerpc64le_unknown_linux_musl
+ //@ [powerpc64le_unknown_linux_musl] compile-flags: --target powerpc64le-unknown-linux-musl
+ //@ [powerpc64le_unknown_linux_musl] needs-llvm-components: powerpc
++//@ revisions: powerpc_foxkit_linux_musl
++//@ [powerpc_foxkit_linux_musl] compile-flags: --target powerpc-foxkit-linux-musl
++//@ [powerpc_foxkit_linux_musl] needs-llvm-components: powerpc
+ //@ revisions: powerpc_unknown_freebsd
+ //@ [powerpc_unknown_freebsd] compile-flags: --target powerpc-unknown-freebsd
+ //@ [powerpc_unknown_freebsd] needs-llvm-components: powerpc
+@@ -510,6 +525,9 @@
+ //@ revisions: x86_64_fortanix_unknown_sgx
+ //@ [x86_64_fortanix_unknown_sgx] compile-flags: --target x86_64-fortanix-unknown-sgx
+ //@ [x86_64_fortanix_unknown_sgx] needs-llvm-components: x86
++//@ revisions: x86_64_foxkit_linux_musl
++//@ [x86_64_foxkit_linux_musl] compile-flags: --target x86_64-foxkit-linux-musl
++//@ [x86_64_foxkit_linux_musl] needs-llvm-components: x86
+ //@ revisions: x86_64_fuchsia
+ //@ [x86_64_fuchsia] compile-flags: --target x86_64-fuchsia
+ //@ [x86_64_fuchsia] needs-llvm-components: x86
diff --git a/experimental/rust-beta/APKBUILD b/experimental/rust-beta/APKBUILD
new file mode 100644
index 000000000..9cc11d211
--- /dev/null
+++ b/experimental/rust-beta/APKBUILD
@@ -0,0 +1,296 @@
+# Maintainer: Samuel Holland <samuel@sholland.org>
+pkgname=rust
+pkgver=1.81.0_beta20240730
+_bootver=1.80.0-r0
+_llvmver=18
+pkgrel=0
+pkgdesc="The Rust Programming Language"
+url="https://www.rust-lang.org"
+arch="all"
+options="!check" # Failures on aarch64 and ppc64.
+license="(Apache-2.0 OR MIT) AND (NCSA OR MIT) AND BSD-2-Clause AND BSD-3-Clause"
+depends="$pkgname-std=$pkgver-r$pkgrel gcc musl-dev"
+makedepends="
+ curl-dev
+ llvm$_llvmver-dev
+ llvm$_llvmver-test-utils
+ openssl-dev
+ python3
+ cargo-bootstrap=$_bootver
+ rust-bootstrap=$_bootver
+ rustfmt-bootstrap=$_bootver
+ zlib-dev
+ "
+provides="$pkgname-bootstrap=$pkgver-r$pkgrel"
+subpackages="
+ $pkgname-dbg
+ $pkgname-std
+ $pkgname-analysis
+ $pkgname-doc
+ $pkgname-gdb::noarch
+ $pkgname-lldb::noarch
+ $pkgname-src::noarch
+ cargo
+ cargo-clippy:_cargo_clippy
+ cargo-fmt:_cargo_fmt
+ cargo-doc:_cargo_doc:noarch
+ cargo-bash-completion:_cargo_bashcomp:noarch
+ cargo-zsh-completion:_cargo_zshcomp:noarch
+ rustfmt
+ "
+source="https://static.rust-lang.org/dist/rustc-beta-src.tar.xz
+ 0001-Fix-LLVM-build.patch
+ 0002-Fix-linking-to-zlib-when-cross-compiling.patch
+ 0003-Fix-rustdoc-when-cross-compiling-on-musl.patch
+ 0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch
+ 0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch
+ 0006-Link-libssp_nonshared.a-on-all-musl-targets.patch
+ 0007-test-failed-doctest-output-Fix-normalization.patch
+ 0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
+ 0009-Ignore-broken-and-non-applicable-tests.patch
+ 0010-Link-stage-2-tools-dynamically-to-libstd.patch
+ 0011-Move-debugger-scripts-to-usr-share-rust.patch
+ 0012-Add-foxkit-target-specs.patch
+ powerpc-atomics.patch
+ stdarch-ppc.patch
+ ui-test-strings.patch
+ "
+builddir="$srcdir/rustc-beta-src"
+_rlibdir="/usr/lib/rustlib/$CTARGET/lib"
+
+build() {
+ cat > config.toml <<- EOF
+ [build]
+ doc-stage = 2
+ build-stage = 2
+ test-stage = 2
+ build = "$CBUILD"
+ host = [ "$CHOST" ]
+ target = [ "$CTARGET" ]
+ cargo = "/usr/bin/cargo"
+ rustc = "/usr/bin/rustc"
+ rustfmt = "/usr/bin/rustfmt"
+ docs = true
+ compiler-docs = false
+ submodules = false
+ python = "python3"
+ locked-deps = true
+ vendor = true
+ extended = true
+ tools = [ "analysis", "cargo", "clippy", "rustfmt", "src" ]
+ verbose = 1
+ sanitizers = false
+ profiler = false
+ cargo-native-static = false
+ [install]
+ prefix = "/usr"
+ [rust]
+ optimize = true
+ debug = false
+ codegen-units = 1
+ debuginfo-level = 2
+ debuginfo-level-rustc = 0
+ debuginfo-level-tests = 0
+ backtrace = true
+ incremental = false
+ parallel-compiler = false
+ channel = "beta"
+ description = "Adelie ${pkgver}-r${pkgrel} [BETA]"
+ rpath = false
+ verbose-tests = true
+ optimize-tests = true
+ codegen-tests = true
+ dist-src = false
+ lld = false
+ use-lld = false
+ llvm-tools = false
+ backtrace-on-ice = true
+ remap-debuginfo = false
+ jemalloc = false
+ llvm-libunwind = "no"
+ new-symbol-mangling = true
+ [target.$CTARGET]
+ cc = "$CTARGET-gcc"
+ cxx = "$CTARGET-g++"
+ ar = "ar"
+ ranlib = "ranlib"
+ linker = "$CTARGET-gcc"
+ llvm-config = "/usr/lib/llvm$_llvmver/bin/llvm-config"
+ crt-static = false
+ [dist]
+ src-tarball = false
+ compression-formats = [ "xz" ]
+ EOF
+
+ LLVM_LINK_SHARED=1 \
+ RUST_BACKTRACE=1 \
+ python3 x.py dist -j ${JOBS:-2}
+}
+
+check() {
+ LLVM_LINK_SHARED=1 \
+ python3 x.py test -j ${JOBS:-2} --no-doc tests/
+}
+
+package() {
+ cd "$builddir"/build/dist
+
+ old_pkgver=$pkgver
+ pkgver=beta
+ tar xf rust-$pkgver-$CTARGET.tar.xz
+ rust-$pkgver-$CTARGET/install.sh \
+ --destdir="$pkgdir" \
+ --prefix=/usr \
+ --sysconfdir="$pkgdir"/etc \
+ --disable-ldconfig
+ tar xf rust-src-$pkgver.tar.xz
+ rust-src-$pkgver/install.sh \
+ --destdir="$pkgdir" \
+ --prefix=/usr \
+ --disable-ldconfig
+ pkgver=$old_pkgver
+
+ rm "$pkgdir"/usr/lib/rustlib/components \
+ "$pkgdir"/usr/lib/rustlib/install.log \
+ "$pkgdir"/usr/lib/rustlib/manifest-* \
+ "$pkgdir"/usr/lib/rustlib/rust-installer-version \
+ "$pkgdir"/usr/lib/rustlib/uninstall.sh
+}
+
+std() {
+ pkgdesc="Standard library for Rust"
+ depends="musl-utils"
+
+ _mv "$pkgdir"$_rlibdir/*.so "$subpkgdir"$_rlibdir
+
+ mkdir -p "$subpkgdir"/etc/ld.so.conf.d
+ echo "$_rlibdir" > "$subpkgdir"/etc/ld.so.conf.d/$pkgname.conf
+}
+
+analysis() {
+ pkgdesc="Compiler analysis data for the Rust standard library"
+ depends="$pkgname=$pkgver-r$pkgrel $pkgname-std=$pkgver-r$pkgrel"
+
+ _mv "$pkgdir"${_rlibdir%/*}/analysis "$subpkgdir"${_rlibdir%/*}
+}
+
+gdb() {
+ pkgdesc="GDB pretty printers for Rust"
+ license="Apache-2.0 OR MIT"
+ depends="$pkgname gdb"
+ install_if="$pkgname=$pkgver-r$pkgrel gdb"
+
+ _mv "$pkgdir"/usr/bin/rust-gdb "$subpkgdir"/usr/bin
+ _mv "$pkgdir"/usr/bin/rust-gdbgui "$subpkgdir"/usr/bin
+ _mv "$pkgdir"/usr/share/rust/gdb_*.py "$subpkgdir"/usr/share/rust
+}
+
+lldb() {
+ pkgdesc="LLDB pretty printers for Rust"
+ license="Apache-2.0 OR MIT"
+ depends="$pkgname lldb py3-lldb"
+ install_if="$pkgname=$pkgver-r$pkgrel lldb"
+
+ _mv "$pkgdir"/usr/bin/rust-lldb "$subpkgdir"/usr/bin
+ _mv "$pkgdir"/usr/share/rust/lldb_*.py "$subpkgdir"/usr/share/rust
+}
+
+src() {
+ pkgdesc="$pkgdesc (source code)"
+ depends=""
+
+ _mv "$pkgdir"/usr/lib/rustlib/src/rust "$subpkgdir"/usr/src
+ rmdir -p "$pkgdir"/usr/lib/rustlib/src 2>/dev/null || true
+
+ mkdir -p "$subpkgdir"/usr/lib/rustlib/src
+ ln -s ../../../src/rust "$subpkgdir"/usr/lib/rustlib/src/rust
+}
+
+cargo() {
+ pkgdesc="The Rust package manager"
+ provides="cargo-bootstrap=$pkgver-r$pkgrel"
+ depends="$pkgname-std=$pkgver-r$pkgrel $pkgname"
+
+ _mv "$pkgdir"/usr/bin/cargo "$subpkgdir"/usr/bin
+}
+
+_cargo_clippy() {
+ pkgdesc="A collection of Rust lints (cargo plugin)"
+ depends="$pkgname-std=$pkgver-r$pkgrel cargo"
+
+ _mv "$pkgdir"/usr/bin/cargo-clippy \
+ "$pkgdir"/usr/bin/clippy-driver \
+ "$subpkgdir"/usr/bin
+}
+
+_cargo_fmt() {
+ pkgdesc="Format Rust code (cargo plugin)"
+ depends="$pkgname-std=$pkgver-r$pkgrel cargo rustfmt"
+ install_if="cargo=$pkgver-r$pkgrel rustfmt=$pkgver-r$pkgrel"
+
+ _mv "$pkgdir"/usr/bin/cargo-fmt "$subpkgdir"/usr/bin
+}
+
+_cargo_bashcomp() {
+ pkgdesc="Bash completion for cargo"
+ license="Apache-2.0 OR MIT"
+ depends=""
+ install_if="cargo=$pkgver-r$pkgrel bash-completion"
+
+ _mv "$pkgdir"/etc/bash_completion.d/cargo \
+ "$subpkgdir"/usr/share/bash-completion/completions
+ rmdir -p "$pkgdir"/etc/bash_completion.d 2>/dev/null || true
+}
+
+_cargo_zshcomp() {
+ pkgdesc="ZSH completion for cargo"
+ license="Apache-2.0 OR MIT"
+ depends=""
+ install_if="cargo=$pkgver-r$pkgrel zsh"
+
+ _mv "$pkgdir"/usr/share/zsh/site-functions/_cargo \
+ "$subpkgdir"/usr/share/zsh/site-functions/_cargo
+ rmdir -p "$pkgdir"/usr/share/zsh/site-functions 2>/dev/null || true
+}
+
+_cargo_doc() {
+ pkgdesc="The Rust package manager (documentation)"
+ license="Apache-2.0 OR MIT"
+ depends=""
+ install_if="cargo=$pkgver-r$pkgrel docs"
+
+ # XXX: This is hackish!
+ _mv "$pkgdir"/../$pkgname-doc/usr/share/man/man1/cargo* \
+ "$subpkgdir"/usr/share/man/man1
+}
+
+rustfmt() {
+ pkgdesc="Format Rust code"
+ provides="rustfmt-bootstrap=$pkgver-r$pkgrel"
+ depends="$pkgname-std=$pkgver-r$pkgrel"
+
+ _mv "$pkgdir"/usr/bin/rustfmt "$subpkgdir"/usr/bin
+}
+
+_mv() {
+ local dest; for dest; do true; done # get last argument
+ mkdir -p "$dest"
+ mv "$@"
+}
+
+sha512sums="4afb071d6980be244a38f82be37dcbccb8c1571d48fbacacaeeea5735a70205b1425e63c6c983bdfa5acda9cb83dcdaff6c9d366af9c5cfde2fb732a06d5072f rustc-beta-src.tar.xz
+59e69884ae98eb90c2ef481d191cca0fb58d904f2a87ccbd5bfa42a8ddeaee3e86aeb8cd99afa8e5b19adf6f229112bd00f8fec3487bd12165362750da07bf35 0001-Fix-LLVM-build.patch
+4408bbf1816194920ffa0770b78f0e25d1ff7487ead061e89a9f11a7d50e7b66d798661cf09eed1b1c186d3550b5de721dd82c9e9d5dabc4ce1edcfbbc84ae88 0002-Fix-linking-to-zlib-when-cross-compiling.patch
+7555557449704b96c922ed353fa770b7c22fd58ef401a4b4d206baacae960217a5cbca79fe0bbf1a2e6705ac3e20c98a042fe4ed111c0780ad83cef5ad73a2da 0003-Fix-rustdoc-when-cross-compiling-on-musl.patch
+f20b8b468687e74e7c9e859973ee2b7d15b277eabeeb1fffe84a129f733375fb347e70151f634c0c45ed3d7b5271e564d57a834a88360b209f02f2f31ee7b717 0004-Remove-musl_root-and-CRT-fallback-from-musl-targets.patch
+6868fe48b7424d39c94ea560037ab4154a0b8f20a027617433d912a5ec60cf0bf1a49da165009345b75f8aedf7d0f81dd23135f9bb28d3f5cd081b56aa74a986 0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch
+b34187a82cd3db02b8aac8f18147d653a7191b841e145460dfbff518a7747a6aa1c08721703929bfc7e446c9ed9512383a5eefaad2cb5c02d16e8f00d12627db 0006-Link-libssp_nonshared.a-on-all-musl-targets.patch
+3b452e5ad7e210e2cb208e0817538a353275143f2b8f4557b7945a51890caa3a32d4b82ccd7278eb0522c1ef8b8b5e6b2d93c08b785284e529373122b8c268b3 0007-test-failed-doctest-output-Fix-normalization.patch
+6850174cebb3dfb2f41e277b0b46db9cabe18c904f39a6775f8cd12dc6c237a7de820a5dc8c538f9b965c069b4197141f0613add096574a7df4ca2d1ae01ab4d 0008-test-sysroot-crates-are-unstable-Fix-test-when-rpath.patch
+f98ae741a9f33a0e3541c6c43a3eb86b653b202d70783435ea2cc1b35c1da8b6db796e9217e243050de05b9ea2520600c5e890481d2366a1da742aad3482fab2 0009-Ignore-broken-and-non-applicable-tests.patch
+19eb11ee4d4ce84edf20b7b0a575704ca26ef8a92cbbd6a0ee06bc1a9cbc287833e953f9fb9412366cdd698174b3001f022bb6fc2f33067dbe2960233698e721 0010-Link-stage-2-tools-dynamically-to-libstd.patch
+c6d94cbb80394d270302a2389c22b528583c4ad7298c7b3f657175912e0abd075b45ec847daa2c8e6e4eb38536a8a37461cd15d78c0f83771d816f11e1cf2e01 0011-Move-debugger-scripts-to-usr-share-rust.patch
+b8bafeae989b853b7003de1bf6bfb7ec64f66c55a7f56989250a500d793875b0b798e073dbff1bb75d0fc885977e70e6b1b2d4ce98ebca657a561f7920de19e1 0012-Add-foxkit-target-specs.patch
+5d57a7a18e0a7f8b7755de89255f97642e4fe585a02465de70227867ac99db84766cd25e702ae13c3a4488504bd4c84eb7e9ceb3a83fdf8f2df0eacf64cc16c1 powerpc-atomics.patch
+705409ef0bf6c690f47f4825a679252e5c446987703d6ba86bc1e80f81e047e7a5559a24924a166222e3f0d0b48f97e902e1ee82f3a977aa7f15fd2ef44f8f01 stdarch-ppc.patch
+c1cdcff68504e5b7b9d5f3081c83c8d8855d9523cc3539bd727f3dc78b7db70b4ce40c76852dd62fc50423128faf86ed8af1c65f7955134af85bc494dd376001 ui-test-strings.patch"
diff --git a/experimental/rust-beta/powerpc-atomics.patch b/experimental/rust-beta/powerpc-atomics.patch
new file mode 100644
index 000000000..1a7d4dbea
--- /dev/null
+++ b/experimental/rust-beta/powerpc-atomics.patch
@@ -0,0 +1,16 @@
+--- rustc-1.60.0-src/vendor/valuable-0.1.0/no_atomic.rs.old 2022-04-04 11:10:57.000000000 +0000
++++ rustc-1.60.0-src/vendor/valuable-0.1.0/no_atomic.rs 2022-11-23 07:36:37.687029241 +0000
+@@ -32,6 +32,7 @@
+ "mipsel-unknown-none",
+ "mipsisa32r6-unknown-linux-gnu",
+ "mipsisa32r6el-unknown-linux-gnu",
++ "powerpc-foxkit-linux-musl",
+ "powerpc-unknown-freebsd",
+ "powerpc-unknown-linux-gnu",
+ "powerpc-unknown-linux-gnuspe",
+--- rustc-1.60.0-src/vendor/valuable-0.1.0/.cargo-checksum.json.old 2022-04-04 11:10:57.000000000 +0000
++++ rustc-1.60.0-src/vendor/valuable-0.1.0/.cargo-checksum.json 2022-11-23 07:38:07.397357603 +0000
+@@ -1 +1 @@
+-{"files":{"Cargo.lock":"fea5e41d2befef0b42734010a85f95548b5255ff1e4ee2dd2e6827adb8fe5f3e","Cargo.toml":"995a2454b4e3e583124d60b694e106ebd193b9742df3e050a6f49e5801b3597b","benches/structable.rs":"1baad763d1b0900004682b139efd58b17c974dc2068ede2229f8786e4a21372e","build.rs":"4ad508d818c27ee58bf7da2b9b4b425dae3e2656850327b3080fe2ad38767928","examples/derive.rs":"238473e63c0647cdb6652f1613575e24b323d40db5c8f3e5c32d64a3ea6b4048","examples/hello_world.rs":"75e48360e53b37e077e574d9c1aa2754b197f551ac5d604b03ebec9d31bab5cf","examples/print.rs":"924c55402b18e518317acc013a6cf407fcc13532c1eca8d9cd5f5631e79df960","no_atomic.rs":"b1c5cb0bd10733eb20516d10edc047b45aa67943f3347ae44fb779ed7fc7aff2","src/enumerable.rs":"008fe833c558f7e956ba0238a9d66947a671f66c5762905ed79d48a428c0ad44","src/field.rs":"c3d96f215c4bfc2a3910d0616fb335332d17f7dcf93ca739c933d88e1f98d229","src/lib.rs":"6954630c4c7c389192f3f8b5097076bbba6e43b5c4cd4ec68b4ffc18bff0a5b4","src/listable.rs":"f1a0743ed650604634972c19b66505a5727a6a6e2d7b54861e65cdcf10949432","src/mappable.rs":"ef7d334ef00d6b34cbff45b73b13935de6659933abafff9ad3d5d2a16d7ccac1","src/named_values.rs":"df5009074379ea59b02ebaf730890d0a4b6fa5c67c4057cc60f84d3652ca2bc5","src/slice.rs":"e382f56eb14ea7848276a4c8bda537f5207a4a6ed7a4b2ee4d2dde7feebce3b4","src/structable.rs":"369b17701d59bab138eac22ec043d434a052f49976236cc5ee680e72ca23ed6e","src/tuplable.rs":"e8b64a0761263666d984257109b5d54337cd97be59f08b08ec153e68ec1636c5","src/valuable.rs":"f8fdef201d3181935330fb86b27c455a5c86079f9f2cad363cda765801d7dd50","src/value.rs":"479d2c5b9d84c930e3abfe0032734ad92b243cf095f5fea6226a9da5eec81484","src/visit.rs":"060bacd3e1c0b333692f96c3ca970ca47a859cc28700713630996d9f0dc1668e"},"package":"830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"}
+\ No newline at end of file
++{"files":{"Cargo.lock":"fea5e41d2befef0b42734010a85f95548b5255ff1e4ee2dd2e6827adb8fe5f3e","Cargo.toml":"995a2454b4e3e583124d60b694e106ebd193b9742df3e050a6f49e5801b3597b","benches/structable.rs":"1baad763d1b0900004682b139efd58b17c974dc2068ede2229f8786e4a21372e","build.rs":"4ad508d818c27ee58bf7da2b9b4b425dae3e2656850327b3080fe2ad38767928","examples/derive.rs":"238473e63c0647cdb6652f1613575e24b323d40db5c8f3e5c32d64a3ea6b4048","examples/hello_world.rs":"75e48360e53b37e077e574d9c1aa2754b197f551ac5d604b03ebec9d31bab5cf","examples/print.rs":"924c55402b18e518317acc013a6cf407fcc13532c1eca8d9cd5f5631e79df960","no_atomic.rs":"66d1146a63de2d24058f657aa14570038b96795a7facbab11402a96b6008f01a","src/enumerable.rs":"008fe833c558f7e956ba0238a9d66947a671f66c5762905ed79d48a428c0ad44","src/field.rs":"c3d96f215c4bfc2a3910d0616fb335332d17f7dcf93ca739c933d88e1f98d229","src/lib.rs":"6954630c4c7c389192f3f8b5097076bbba6e43b5c4cd4ec68b4ffc18bff0a5b4","src/listable.rs":"f1a0743ed650604634972c19b66505a5727a6a6e2d7b54861e65cdcf10949432","src/mappable.rs":"ef7d334ef00d6b34cbff45b73b13935de6659933abafff9ad3d5d2a16d7ccac1","src/named_values.rs":"df5009074379ea59b02ebaf730890d0a4b6fa5c67c4057cc60f84d3652ca2bc5","src/slice.rs":"e382f56eb14ea7848276a4c8bda537f5207a4a6ed7a4b2ee4d2dde7feebce3b4","src/structable.rs":"369b17701d59bab138eac22ec043d434a052f49976236cc5ee680e72ca23ed6e","src/tuplable.rs":"e8b64a0761263666d984257109b5d54337cd97be59f08b08ec153e68ec1636c5","src/valuable.rs":"f8fdef201d3181935330fb86b27c455a5c86079f9f2cad363cda765801d7dd50","src/value.rs":"479d2c5b9d84c930e3abfe0032734ad92b243cf095f5fea6226a9da5eec81484","src/visit.rs":"060bacd3e1c0b333692f96c3ca970ca47a859cc28700713630996d9f0dc1668e"},"package":"830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"}
diff --git a/experimental/rust-beta/stdarch-ppc.patch b/experimental/rust-beta/stdarch-ppc.patch
new file mode 100644
index 000000000..5b6b9cc5c
--- /dev/null
+++ b/experimental/rust-beta/stdarch-ppc.patch
@@ -0,0 +1,114 @@
+From 7ac103f60d54362a752361dee3e63e23b98a342a Mon Sep 17 00:00:00 2001
+From: Luca Barbato <lu_zero@gentoo.org>
+Date: Tue, 11 Jun 2024 09:49:16 +0000
+Subject: [PATCH] Use longer associated types in the Altivec traits
+
+---
+ crates/core_arch/src/powerpc/altivec.rs | 34 ++++++++++++-------------
+ 1 file changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/library/stdarch/crates/core_arch/src/powerpc/altivec.rs b/library/stdarch/crates/core_arch/src/powerpc/altivec.rs
+index 627809c6bc..29cdc41017 100644
+--- a/library/stdarch/crates/core_arch/src/powerpc/altivec.rs
++++ b/library/stdarch/crates/core_arch/src/powerpc/altivec.rs
+@@ -410,8 +410,8 @@ mod sealed {
+
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+ pub trait VectorInsert {
+- type S;
+- unsafe fn vec_insert<const IDX: u32>(self, s: Self::S) -> Self;
++ type Scalar;
++ unsafe fn vec_insert<const IDX: u32>(self, s: Self::Scalar) -> Self;
+ }
+
+ const fn idx_in_vec<T, const IDX: u32>() -> u32 {
+@@ -422,11 +422,11 @@ mod sealed {
+ ($ty:ident) => {
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+ impl VectorInsert for t_t_l!($ty) {
+- type S = $ty;
++ type Scalar = $ty;
+ #[inline]
+ #[target_feature(enable = "altivec")]
+- unsafe fn vec_insert<const IDX: u32>(self, s: Self::S) -> Self {
+- simd_insert(self, const { idx_in_vec::<Self::S, IDX>() }, s)
++ unsafe fn vec_insert<const IDX: u32>(self, s: Self::Scalar) -> Self {
++ simd_insert(self, const { idx_in_vec::<Self::Scalar, IDX>() }, s)
+ }
+ }
+ };
+@@ -442,19 +442,19 @@ mod sealed {
+
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+ pub trait VectorExtract {
+- type S;
+- unsafe fn vec_extract<const IDX: u32>(self) -> Self::S;
++ type Scalar;
++ unsafe fn vec_extract<const IDX: u32>(self) -> Self::Scalar;
+ }
+
+ macro_rules! impl_vec_extract {
+ ($ty:ident) => {
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+ impl VectorExtract for t_t_l!($ty) {
+- type S = $ty;
++ type Scalar = $ty;
+ #[inline]
+ #[target_feature(enable = "altivec")]
+- unsafe fn vec_extract<const IDX: u32>(self) -> Self::S {
+- simd_extract(self, const { idx_in_vec::<Self::S, IDX>() })
++ unsafe fn vec_extract<const IDX: u32>(self) -> Self::Scalar {
++ simd_extract(self, const { idx_in_vec::<Self::Scalar, IDX>() })
+ }
+ }
+ };
+@@ -3233,18 +3233,18 @@ mod sealed {
+
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+ pub trait VectorRl {
+- type B;
+- unsafe fn vec_rl(self, b: Self::B) -> Self;
++ type Shift;
++ unsafe fn vec_rl(self, b: Self::Shift) -> Self;
+ }
+
+ macro_rules! impl_vec_rl {
+ ($fun:ident ($a:ident)) => {
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+ impl VectorRl for $a {
+- type B = t_u!($a);
++ type Shift = t_u!($a);
+ #[inline]
+ #[target_feature(enable = "altivec")]
+- unsafe fn vec_rl(self, b: Self::B) -> Self {
++ unsafe fn vec_rl(self, b: Self::Shift) -> Self {
+ transmute($fun(transmute(self), b))
+ }
+ }
+@@ -3292,7 +3292,7 @@ mod sealed {
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+-pub unsafe fn vec_insert<T, const IDX: u32>(a: T, b: <T as sealed::VectorInsert>::S) -> T
++pub unsafe fn vec_insert<T, const IDX: u32>(a: T, b: <T as sealed::VectorInsert>::Scalar) -> T
+ where
+ T: sealed::VectorInsert,
+ {
+@@ -3310,7 +3310,7 @@ where
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+-pub unsafe fn vec_extract<T, const IDX: u32>(a: T) -> <T as sealed::VectorExtract>::S
++pub unsafe fn vec_extract<T, const IDX: u32>(a: T) -> <T as sealed::VectorExtract>::Scalar
+ where
+ T: sealed::VectorExtract,
+ {
+@@ -3949,7 +3949,7 @@ where
+ #[inline]
+ #[target_feature(enable = "altivec")]
+ #[unstable(feature = "stdarch_powerpc", issue = "111145")]
+-pub unsafe fn vec_rl<T>(a: T, b: <T as sealed::VectorRl>::B) -> T
++pub unsafe fn vec_rl<T>(a: T, b: <T as sealed::VectorRl>::Shift) -> T
+ where
+ T: sealed::VectorRl,
+ {
diff --git a/experimental/rust-beta/ui-test-strings.patch b/experimental/rust-beta/ui-test-strings.patch
new file mode 100644
index 000000000..182a233b0
--- /dev/null
+++ b/experimental/rust-beta/ui-test-strings.patch
@@ -0,0 +1,25 @@
+check-cfg/well-known-values: We add our own vendor, so we need to include it.
+
+codegen/duplicated-path-in-error: musl's ldso error doesn't match glibc's.
+
+diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
+index 00abb5f5e5c..84648541fb7 100644
+--- a/tests/ui/check-cfg/well-known-values.stderr
++++ b/tests/ui/check-cfg/well-known-values.stderr
+@@ -230,7 +230,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
+ LL | target_vendor = "_UNEXPECTED_VALUE",
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+- = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `ibm`, `kmc`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
++ = note: expected values for `target_vendor` are: `apple`, `espressif`, `fortanix`, `foxkit`, `ibm`, `kmc`, `nintendo`, `nvidia`, `pc`, `risc0`, `sony`, `sun`, `unikraft`, `unknown`, `uwp`, `win7`, and `wrs`
+ = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
+
+ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
+diff --git a/tests/ui/codegen/duplicated-path-in-error.stderr b/tests/ui/codegen/duplicated-path-in-error.stderr
+index d0d34e2f934..2892ebffdde 100644
+--- a/tests/ui/codegen/duplicated-path-in-error.stderr
++++ b/tests/ui/codegen/duplicated-path-in-error.stderr
+@@ -1,2 +1,2 @@
+-error: couldn't load codegen backend /non-existing-one.so: cannot open shared object file: No such file or directory
++error: couldn't load codegen backend /non-existing-one.so: Error loading shared library /non-existing-one.so: No such file or directory
+