rust: update to 1.85.0

This commit is contained in:
tranzystorekk 2025-02-20 19:57:59 +01:00
parent 0063302c87
commit 49010f8445
6 changed files with 292 additions and 114 deletions

View File

@ -6,10 +6,10 @@ Subject: [PATCH 02/15] Remove -nostdlib and musl_root from musl targets
extended by various void contributors to match our musl setup
diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
index e020bb8523..7b0cc7b556 100644
index 1a854fe36..7b0cc7b55 100644
--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
@@ -1,15 +1,9 @@
@@ -1,12 +1,9 @@
-use crate::spec::{LinkSelfContainedDefault, TargetOptions, base, crt_objects};
+use crate::spec::{base, TargetOptions};
@ -20,14 +20,11 @@ index e020bb8523..7b0cc7b556 100644
- 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;
base
}
diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs
index e3b6430a46..13a96e2cb7 100644
index e3b6430a4..13a96e2cb 100644
--- a/compiler/rustc_target/src/spec/crt_objects.rs
+++ b/compiler/rustc_target/src/spec/crt_objects.rs
@@ -62,28 +62,6 @@ pub(super) fn all(obj: &'static str) -> CrtObjects {
@ -59,11 +56,77 @@ index e3b6430a46..13a96e2cb7 100644
pub(super) fn pre_mingw_self_contained() -> CrtObjects {
new(&[
(LinkOutputKind::DynamicNoPicExe, &["crt2.o", "rsbegin.o"]),
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 4fefdfa5c..bb65048a5 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
@@ -12,9 +12,6 @@ pub(crate) fn target() -> Target {
| SanitizerSet::MEMORY
| SanitizerSet::THREAD;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
-
Target {
llvm_target: "aarch64-unknown-linux-musl".into(),
metadata: crate::spec::TargetMetadata {
diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
index 4bbde7667..50f1a8d88 100644
--- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs
@@ -20,8 +20,6 @@ pub(crate) fn target() -> Target {
features: "+strict-align,+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
index 22e49f2f1..28a954758 100644
--- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
+++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs
@@ -23,8 +23,6 @@ pub(crate) fn target() -> Target {
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- crt_static_default: true,
..base::linux_musl::opts()
},
}
diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
index 6ba87c732..b805b80b8 100644
--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
@@ -6,8 +6,6 @@ pub(crate) fn target() -> Target {
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32", "-Wl,-melf_i386"]);
base.stack_probes = StackProbeType::Inline;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
// The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
// implementation, apparently relies on frame pointers existing... somehow.
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
index 8dcdc5be8..8be0f335d 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
@@ -14,8 +14,6 @@ pub(crate) fn target() -> Target {
| SanitizerSet::MEMORY
| SanitizerSet::THREAD;
base.supports_xray = true;
- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
- base.crt_static_default = true;
Target {
llvm_target: "x86_64-unknown-linux-musl".into(),
diff --git a/config.example.toml b/config.example.toml
index d3233ad17b..8c1c336ea5 100644
index 5ea6774ce..ed0da89d7 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -627,14 +627,6 @@
@@ -629,14 +629,6 @@
# behavior -- this may lead to miscompilations or other bugs.
#description = ""
@ -79,49 +142,91 @@ index d3233ad17b..8c1c336ea5 100644
# 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
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 70f4e70962..51e33251b2 100755
index a86c20d46..9358154de 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -102,34 +102,6 @@ v("llvm-config", None, "set path to llvm-config")
@@ -175,76 +175,6 @@ v("llvm-config", None, "set path to llvm-config")
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",
-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-powerpc64le",
"target.powerpc64le-unknown-linux-musl.musl-root",
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 8e088682f9..2ea50a068f 100644
index eeb5b18fd..4ee47e7c4 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -352,39 +352,7 @@ fn copy_self_contained_objects(
@@ -331,39 +331,7 @@ fn copy_self_contained_objects(
let mut target_deps = vec![];
// Copies the libc and CRT objects.
@ -162,7 +267,7 @@ index 8e088682f9..2ea50a068f 100644
let srcdir = builder.wasi_libdir(target).unwrap_or_else(|| {
panic!(
"Target {:?} does not have a \"wasi-root\" key in Config.toml \
@@ -546,15 +514,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
@@ -530,15 +498,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
.arg("--manifest-path")
.arg(builder.src.join("library/sysroot/Cargo.toml"));
@ -179,7 +284,7 @@ index 8e088682f9..2ea50a068f 100644
if let Some(dir) = builder.wasi_libdir(target) {
let root = format!("native={}", dir.to_str().unwrap());
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index e706aba977..b876972c0a 100644
index 0587408e9..ad3b1c374 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -346,7 +346,6 @@ pub struct Config {
@ -190,7 +295,7 @@ index e706aba977..b876972c0a 100644
pub prefix: Option<PathBuf>,
pub sysconfdir: Option<PathBuf>,
pub datadir: Option<PathBuf>,
@@ -620,8 +619,6 @@ pub struct Target {
@@ -627,8 +626,6 @@ pub struct Target {
pub profiler: Option<StringOrBool>,
pub rpath: Option<bool>,
pub crt_static: Option<bool>,
@ -199,7 +304,7 @@ index e706aba977..b876972c0a 100644
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub runner: Option<String>,
@@ -1151,7 +1148,6 @@ define_config! {
@@ -1157,7 +1154,6 @@ define_config! {
default_linker: Option<String> = "default-linker",
channel: Option<String> = "channel",
description: Option<String> = "description",
@ -207,7 +312,7 @@ index e706aba977..b876972c0a 100644
rpath: Option<bool> = "rpath",
strip: Option<bool> = "strip",
frame_pointers: Option<bool> = "frame-pointers",
@@ -1206,8 +1202,6 @@ define_config! {
@@ -1212,8 +1208,6 @@ define_config! {
profiler: Option<StringOrBool> = "profiler",
rpath: Option<bool> = "rpath",
crt_static: Option<bool> = "crt-static",
@ -216,7 +321,7 @@ index e706aba977..b876972c0a 100644
wasi_root: Option<String> = "wasi-root",
qemu_rootfs: Option<String> = "qemu-rootfs",
no_std: Option<bool> = "no-std",
@@ -1736,7 +1730,6 @@ impl Config {
@@ -1758,7 +1752,6 @@ impl Config {
default_linker,
channel: _, // already handled above
description,
@ -224,7 +329,7 @@ index e706aba977..b876972c0a 100644
rpath,
verbose_tests,
optimize_tests,
@@ -1822,7 +1815,6 @@ impl Config {
@@ -1866,7 +1859,6 @@ impl Config {
config.llvm_enzyme =
llvm_enzyme.unwrap_or(config.channel == "dev" || config.channel == "nightly");
config.rustc_default_linker = default_linker;
@ -232,7 +337,7 @@ index e706aba977..b876972c0a 100644
config.save_toolstates = save_toolstates.map(PathBuf::from);
set(&mut config.deny_warnings, match flags.warnings {
Warnings::Deny => Some(true),
@@ -2044,8 +2036,6 @@ impl Config {
@@ -2088,8 +2080,6 @@ impl Config {
target.ranlib = cfg.ranlib.map(PathBuf::from);
target.linker = cfg.linker.map(PathBuf::from);
target.crt_static = cfg.crt_static;
@ -241,16 +346,16 @@ index e706aba977..b876972c0a 100644
target.wasi_root = cfg.wasi_root.map(PathBuf::from);
target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from);
target.runner = cfg.runner;
@@ -3123,7 +3113,6 @@ fn check_incompatible_options_for_ci_rustc(
@@ -3212,7 +3202,6 @@ fn check_incompatible_options_for_ci_rustc(
debuginfo_level_tools: _,
debuginfo_level_tests: _,
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 fabb4f2b13..7246668378 100644
index ed0155622..9873a6c09 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -11,7 +11,7 @@
@ -261,8 +366,8 @@ index fabb4f2b13..7246668378 100644
+use std::env;
use crate::Build;
#[cfg(not(feature = "bootstrap-self-test"))]
@@ -326,28 +326,6 @@ than building it.
#[cfg(not(test))]
@@ -321,28 +321,6 @@ than building it.
continue;
}
@ -292,10 +397,10 @@ index fabb4f2b13..7246668378 100644
// 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 c384fd6bf4..cadb129e2c 100644
index ccc115a27..7cc8cc0c5 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1307,25 +1307,6 @@ Executed at: {executed_at}"#,
@@ -1283,25 +1283,6 @@ Executed at: {executed_at}"#,
}
}
@ -322,10 +427,10 @@ index c384fd6bf4..cadb129e2c 100644
/// configured.
///
diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs
index 0df0046945..f044b1791e 100644
index 4aec554b4..211efb6e3 100644
--- a/src/bootstrap/src/utils/cc_detect.rs
+++ b/src/bootstrap/src/utils/cc_detect.rs
@@ -210,30 +210,6 @@ fn default_compiler(
@@ -220,30 +220,6 @@ fn default_compiler(
}
}

View File

@ -3,27 +3,25 @@ From: Daniel Kolesa <daniel@octaforge.org>
Date: Tue, 21 Dec 2021 00:48:29 +0100
Subject: [PATCH 09/15] do not export LD_LIBRARY_PATH
---
src/bootstrap/bootstrap.py | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 40d478a17..3501fd901 100644
index 535bdecb0..75d23899b 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -756,12 +756,6 @@ class RustBuild(object):
@@ -1023,17 +1023,6 @@ class RustBuild(object):
del env["CARGO_BUILD_TARGET"]
env["CARGO_TARGET_DIR"] = build_dir
env["RUSTC"] = self.rustc()
- env["LD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
- (os.pathsep + env["LD_LIBRARY_PATH"]) \
- if "LD_LIBRARY_PATH" in env else ""
- env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
- (os.pathsep + env["DYLD_LIBRARY_PATH"]) \
- if "DYLD_LIBRARY_PATH" in env else ""
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
(os.pathsep + env["LIBRARY_PATH"]) \
if "LIBRARY_PATH" in env else ""
--
2.37.2
- env["LD_LIBRARY_PATH"] = (
- os.path.join(self.bin_root(), "lib") + (os.pathsep + env["LD_LIBRARY_PATH"])
- if "LD_LIBRARY_PATH" in env
- else ""
- )
- env["DYLD_LIBRARY_PATH"] = (
- os.path.join(self.bin_root(), "lib")
- + (os.pathsep + env["DYLD_LIBRARY_PATH"])
- if "DYLD_LIBRARY_PATH" in env
- else ""
- )
env["LIBRARY_PATH"] = (
os.path.join(self.bin_root(), "lib") + (os.pathsep + env["LIBRARY_PATH"])
if "LIBRARY_PATH" in env

View File

@ -3,14 +3,14 @@ From: q66 <daniel@octaforge.org>
Date: Sun, 3 May 2020 18:02:03 +0200
Subject: [PATCH 10/15] Fix dynamic linkage of musl libc for the libc crate
diff --git a/vendor/libc-0.2.162/src/unix/mod.rs b/vendor/libc-0.2.162/src/unix/mod.rs
index d26d905355..b6b59e38d0 100644
--- a/vendor/libc-0.2.162/src/unix/mod.rs
+++ b/vendor/libc-0.2.162/src/unix/mod.rs
@@ -384,7 +384,14 @@ cfg_if! {
diff --git a/vendor/libc-0.2.169/src/unix/mod.rs b/vendor/libc-0.2.169/src/unix/mod.rs
index a14dafdf0..6aabd6765 100644
--- a/vendor/libc-0.2.169/src/unix/mod.rs
+++ b/vendor/libc-0.2.169/src/unix/mod.rs
@@ -444,7 +444,14 @@ cfg_if! {
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
extern {}
extern "C" {}
- } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
+ } else if #[cfg(target_env = "musl")] {
+ #[link(name = "c")]
@ -20,26 +20,6 @@ index d26d905355..b6b59e38d0 100644
+ cfg(target_feature = "crt-static")))]
+ extern {}
+ } else if #[cfg(target_env = "ohos")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static")))]
diff --git a/vendor/libc-0.2.164/src/unix/mod.rs b/vendor/libc-0.2.164/src/unix/mod.rs
index db60f8ef29..fd506f7d56 100644
--- a/vendor/libc-0.2.164/src/unix/mod.rs
+++ b/vendor/libc-0.2.164/src/unix/mod.rs
@@ -384,7 +384,14 @@ cfg_if! {
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
extern {}
- } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
+ } else if #[cfg(target_env = "musl")] {
+ #[link(name = "c")]
+ extern {}
+ #[cfg_attr(feature = "rustc-dep-of-std",
+ link(name = "gcc", kind = "static", modifiers = "-bundle",
+ cfg(target_feature = "crt-static")))]
+ extern {}
+ } else if #[cfg(target_env = "ohos")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static")))]
#[cfg_attr(
feature = "rustc-dep-of-std",
link(

View File

@ -9,7 +9,7 @@ binaries), rustc never requests specific ABI from llvm in the first place,
so at least match the environment we have.
diff --git a/compiler/rustc_target/src/callconv/powerpc64.rs b/compiler/rustc_target/src/callconv/powerpc64.rs
index 71e533b8cc..24beb8254c 100644
index 3a71592cb..24beb8254 100644
--- a/compiler/rustc_target/src/callconv/powerpc64.rs
+++ b/compiler/rustc_target/src/callconv/powerpc64.rs
@@ -3,7 +3,7 @@
@ -25,7 +25,7 @@ index 71e533b8cc..24beb8254c 100644
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout + HasTargetSpec,
{
- let abi = if cx.target_spec().env == "musl" {
- let abi = if cx.target_spec().env == "musl" || cx.target_spec().os == "freebsd" {
- ELFv2
- } else if cx.target_spec().os == "aix" {
- AIX

View File

@ -0,0 +1,97 @@
Ported from https://github.com/rust-lang/rust/pull/137632
diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs
index 7e80d014e..4d1c10bbc 100644
--- a/compiler/rustc_codegen_ssa/src/target_features.rs
+++ b/compiler/rustc_codegen_ssa/src/target_features.rs
@@ -62,24 +62,26 @@ pub(crate) fn from_target_feature_attr(
return None;
};
- // Only allow target features whose feature gates have been enabled
- // and which are permitted to be toggled.
- if let Err(reason) = stability.toggle_allowed(/*enable*/ true) {
- tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
- span: item.span(),
- feature,
- reason,
- });
- } else if let Some(nightly_feature) = stability.requires_nightly()
- && !rust_features.enabled(nightly_feature)
- {
- feature_err(
- &tcx.sess,
- nightly_feature,
- item.span(),
- format!("the target feature `{feature}` is currently unstable"),
- )
- .emit();
+ if !tcx.sess.opts.actually_rustdoc {
+ // Only allow target features whose feature gates have been enabled
+ // and which are permitted to be toggled.
+ if let Err(reason) = stability.toggle_allowed(/*enable*/ true) {
+ tcx.dcx().emit_err(errors::ForbiddenTargetFeatureAttr {
+ span: item.span(),
+ feature,
+ reason,
+ });
+ } else if let Some(nightly_feature) = stability.requires_nightly()
+ && !rust_features.enabled(nightly_feature)
+ {
+ feature_err(
+ &tcx.sess,
+ nightly_feature,
+ item.span(),
+ format!("the target feature `{feature}` is currently unstable"),
+ )
+ .emit();
+ }
}
Some(Symbol::intern(feature))
}));
@@ -149,9 +151,42 @@ pub(crate) fn provide(providers: &mut Providers) {
assert_eq!(cnum, LOCAL_CRATE);
let target = &tcx.sess.target;
if tcx.sess.opts.actually_rustdoc {
- // rustdoc needs to be able to document functions that use all the features, so
- // whitelist them all
- rustc_target::target_features::all_rust_features()
+ // HACK: rustdoc would like to pretend that we have all the target features, so we
+ // have to merge all the lists into one. To ensure an unstable target never prevents
+ // a stable one from working, we merge the stability info of all instances of the
+ // same target feature name, with the "most stable" taking precedence. And then we
+ // hope that this doesn't cause issues anywhere else in the compiler...
+ use target_features::StabilityUncomputed;
+ use rustc_data_structures::fx::FxHashMap;
+ let mut result: FxHashMap<String, StabilityUncomputed> = Default::default();
+ for (name, stability) in rustc_target::target_features::all_rust_features() {
+ use std::collections::hash_map::Entry;
+ match result.entry(name.to_owned()) {
+ Entry::Vacant(vacant_entry) => {
+ vacant_entry.insert(stability);
+ }
+ Entry::Occupied(mut occupied_entry) => {
+ // Merge the two stabilities, "more stable" taking precedence.
+ match (occupied_entry.get(), &stability) {
+ (StabilityUncomputed::Stable { .. }, _)
+ | (
+ StabilityUncomputed::Unstable { .. },
+ StabilityUncomputed::Unstable { .. } | StabilityUncomputed::Forbidden { .. },
+ )
+ | (StabilityUncomputed::Forbidden { .. }, StabilityUncomputed::Forbidden { .. }) => {
+ // The stability in the entry is at least as good as the new one, just keep it.
+ }
+ _ => {
+ // Overwrite stabilite.
+ occupied_entry.insert(stability.clone());
+ }
+ }
+ }
+ }
+ }
+ #[allow(rustc::potential_query_instability)]
+ result
+ .iter()
.map(|(a, b)| (a.to_string(), b.compute_toggleability(target)))
.collect()
} else {

View File

@ -8,7 +8,7 @@
# uploaded to https://repo-default.voidlinux.org/distfiles/
#
pkgname=rust
version=1.84.1
version=1.85.0
revision=1
_llvmver=19
hostmakedepends="curl pkg-config python3 tar cargo-bootstrap"
@ -19,7 +19,7 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
license="Apache-2.0 OR MIT"
homepage="https://www.rust-lang.org/"
distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
checksum=5e2fb5d49628a549f7671b2ccf9855ab379fd442831a7c2af16e0cdcc31bb375
checksum=2f4f3142ffb7c8402139cfa0796e24baaac8b9fd3f96b2deec3b94b4045c6a8a
lib32disabled=yes
make_check=no # CBA for now
python_version=3 # needed for python files in rust-src
@ -59,8 +59,7 @@ post_patch() {
fi
# clear out all the checksum nonsense of patched vendor crates
_clear_vendor_checksums libc-0.2.162
_clear_vendor_checksums libc-0.2.164
_clear_vendor_checksums libc-0.2.169
# pre-configure 01-override-config overwrites vendor files
_clear_vendor_checksums onig_sys-69.8.1
@ -138,7 +137,6 @@ do_configure() {
--set="rust.codegen-units=1" \
--set="rust.codegen-units-std=1" \
--set="rust.incremental=false" \
--set="rust.parallel-compiler=false" \
--set="rust.jemalloc=false" \
--set="rust.llvm-tools=false" \
--set="build.submodules=false" \