rust rebuild

This commit is contained in:
Rmys
2025-11-15 16:09:20 +03:00
parent ea848787a3
commit 30dd66d16d
11 changed files with 135 additions and 247 deletions
@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Thu, 7 Aug 2025 19:01:26 +0200
Subject: [PATCH] bootstrap: Workaround for system stage0
See: https://github.com/rust-lang/rust/issues/143735
---
src/bootstrap/src/core/build_steps/compile.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 82fd1119c7fe..0e1e2a2d39fd 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -794,7 +794,10 @@ fn run(self, builder: &Builder<'_>) {
let _ = fs::remove_dir_all(sysroot.join("lib/rustlib/src/rust"));
}
- builder.cp_link_r(&builder.initial_sysroot.join("lib"), &sysroot.join("lib"));
+ builder.cp_link_r(
+ &builder.initial_sysroot.join("lib/rustlib"),
+ &sysroot.join("lib/rustlib"),
+ );
} else {
if builder.download_rustc() {
// Ensure there are no CI-rustc std artifacts.
@@ -0,0 +1,67 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Fri, 12 Mar 2021 17:31:56 +0100
Subject: [PATCH] compiler: Change LLVM targets
- Change x86_64-unknown-linux-gnu to use x86_64-pc-linux-gnu
- Change i686-unknown-linux-gnu to use i686-pc-linux-gnu
Reintroduce the aliasing that was removed in 1.52.0 and alias the -pc-
triples to the -unknown- triples. This avoids defining proper -pc-
targets, as things break when this is done:
- The crate ecosystem expects the -unknown- targets. Making -pc-
rustc's host triple (and thus default target) would break various
crates.
- Firefox's build breaks when the host triple (from
`rustc --version --verbose`) is different from the target triple
(from `rustc --print target-list`) that best matches autoconf.
---
compiler/rustc_session/src/config.rs | 6 ++++++
.../rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs | 2 +-
.../src/spec/targets/x86_64_unknown_linux_gnu.rs | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 5e47559847e0..bd7965540560 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -2374,6 +2374,12 @@ pub fn parse_target_triple(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches
early_dcx.early_fatal(format!("target file {path:?} does not exist"))
})
}
+ Some(target) if &target == "x86_64-pc-linux-gnu" => {
+ TargetTuple::from_tuple("x86_64-unknown-linux-gnu")
+ }
+ Some(target) if &target == "i686-pc-linux-gnu" => {
+ TargetTuple::from_tuple("i686-unknown-linux-gnu")
+ }
Some(target) => TargetTuple::TargetTuple(target),
_ => TargetTuple::from_tuple(host_tuple()),
}
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
index c70c026f9f71..5ffa2eb8eddb 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs
@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
base.stack_probes = StackProbeType::Inline;
Target {
- llvm_target: "i686-unknown-linux-gnu".into(),
+ llvm_target: "i686-pc-linux-gnu".into(),
metadata: TargetMetadata {
description: Some("32-bit Linux (kernel 3.2, glibc 2.17+)".into()),
tier: Some(1),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
index 0c8353fad182..d2b414766d4d 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
@@ -28,7 +28,7 @@ pub(crate) fn target() -> Target {
}
Target {
- llvm_target: "x86_64-unknown-linux-gnu".into(),
+ llvm_target: "x86_64-pc-linux-gnu".into(),
metadata: TargetMetadata {
description: Some("64-bit Linux (kernel 3.2+, glibc 2.17+)".into()),
tier: Some(1),
@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Fri, 19 Sep 2025 17:11:42 +0200
Subject: [PATCH] compiler: Use ld.lld by default
Change the default linker flavor to use LLD. This avoids the self-
contained rust-lld, which can only be built when also building LLVM.
See: https://gitlab.archlinux.org/archlinux/packaging/packages/rust/-/issues/8
---
compiler/rustc_target/src/spec/mod.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 07fb1ce63f7c..fd5f0606e474 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -2472,7 +2472,7 @@ fn default() -> TargetOptions {
abi: "".into(),
vendor: "unknown".into(),
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()),
- linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
+ linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::Yes),
linker_flavor_json: LinkerFlavorCli::Gcc,
lld_flavor_json: LldFlavor::Ld,
linker_is_gnu_json: true,
@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 4 Jan 2025 06:52:13 +0100
Subject: [PATCH] compiler: Use aarch64-linux-gnu-gcc to link aarch64 targets
Otherwise it defaults to 'cc', which is inappropriate as we're
cross-compiling.
---
.../rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs | 1 +
.../rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs | 1 +
2 files changed, 2 insertions(+)
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
index 4220d74dfc89..f1aca6f68a17 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs
@@ -32,6 +32,7 @@ pub(crate) fn target() -> Target {
| SanitizerSet::THREAD
| SanitizerSet::HWADDRESS,
supports_xray: true,
+ linker: Some("aarch64-linux-gnu-gcc".into()),
..base::linux_gnu::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
index 478726fbef69..e97bd41abc35 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
@@ -13,6 +13,7 @@ pub(crate) fn target() -> Target {
| SanitizerSet::LEAK
| SanitizerSet::MEMORY
| SanitizerSet::THREAD;
+ base.linker = Some("aarch64-linux-gnu-gcc".into());
// FIXME(compiler-team#422): musl targets should be dynamically linked by default.
base.crt_static_default = true;