AlmaLinux changes: AlmaLinux change: Use the correct architecture in x86_64_v2

This commit is contained in:
Eduard Abdullin 2025-02-11 11:06:48 +03:00 committed by eabdullin
commit c1aff78e35
12 changed files with 187 additions and 305 deletions

3
.gitignore vendored
View File

@ -445,3 +445,6 @@
/rustc-1.82.0-src.tar.xz
/wasi-libc-wasi-sdk-24.tar.gz
/rustc-1.83.0-src.tar.xz
/rustc-1.84.0-src.tar.xz
/wasi-libc-wasi-sdk-25.tar.gz
/rustc-1.84.1-src.tar.xz

View File

@ -1,4 +1,4 @@
From e12de251f8513f660bbfbc1c71883383bd1037f4 Mon Sep 17 00:00:00 2001
From 5273432acfae75d6e509bbebcf8d28b0f3d820d0 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 9 Jun 2023 15:23:08 -0700
Subject: [PATCH] Let environment variables override some default CPUs
@ -23,7 +23,7 @@ index 23913687a1fd..3253fbc84c74 100644
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
index 3efbb4648361..bcdaa5b8276d 100644
index a84a18a433ff..441af1018ff3 100644
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
@@ -5,7 +5,7 @@ pub(crate) fn target() -> Target {
@ -32,9 +32,9 @@ index 3efbb4648361..bcdaa5b8276d 100644
// z10 is the oldest CPU supported by LLVM
- base.cpu = "z10".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_S390X").unwrap_or("z10").into();
// FIXME: The ABI implementation in abi/call/s390x.rs is for now hard-coded to assume the no-vector
// ABI. Pass the -vector feature string to LLVM to respect this assumption.
base.features = "-vector".into();
base.max_atomic_width = Some(128);
base.min_global_align = Some(16);
base.stack_probes = StackProbeType::Inline;
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 59ec6c7f9d5f..b6f1be890b20 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
@ -49,5 +49,5 @@ index 59ec6c7f9d5f..b6f1be890b20 100644
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
--
2.47.0
2.47.1

View File

@ -0,0 +1,39 @@
From e4e678eb9cbd90acf2ba51e9ec0209b05c4403b5 Mon Sep 17 00:00:00 2001
From: Josh Stone <cuviper@gmail.com>
Date: Thu, 9 Jan 2025 16:47:10 -0800
Subject: [PATCH] Only translate profile flags for Clang
---
src/flags.rs | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/flags.rs b/src/flags.rs
index 81834cf625f7..1a53c1b2345c 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -201,13 +201,15 @@ impl<'this> RustcCodegenFlags<'this> {
if self.no_vectorize_slp {
push_if_supported("-fno-slp-vectorize".into());
}
- // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-generate
- if let Some(value) = self.profile_generate {
- push_if_supported(format!("-fprofile-generate={value}").into());
- }
- // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-use
- if let Some(value) = self.profile_use {
- push_if_supported(format!("-fprofile-use={value}").into());
+ if let ToolFamily::Clang { .. } = family {
+ // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-generate
+ if let Some(value) = self.profile_generate {
+ push_if_supported(format!("-fprofile-generate={value}").into());
+ }
+ // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-use
+ if let Some(value) = self.profile_use {
+ push_if_supported(format!("-fprofile-use={value}").into());
+ }
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mguard
if let Some(value) = self.control_flow_guard {
--
2.47.1

View File

@ -1,4 +1,4 @@
From babdaf8354098399ec98c96eb3a3627664d6ba03 Mon Sep 17 00:00:00 2001
From 8d4d52446347872816ab51958e9f3162cf722ee6 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
@ -11,10 +11,10 @@ Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
4 files changed, 22 insertions(+)
diff --git a/config.example.toml b/config.example.toml
index f1dc32234ccf..82207f19d471 100644
index d3233ad17b51..6a1f097c20cb 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -880,6 +880,11 @@
@@ -916,6 +916,11 @@
# argument as the test binary.
#runner = <none> (string)
@ -27,10 +27,10 @@ index f1dc32234ccf..82207f19d471 100644
# Distribution options
#
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index edf18e2ebf33..d48d027f329c 100644
index 8e088682f92d..843b7123b120 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -367,6 +367,10 @@ fn copy_self_contained_objects(
@@ -346,6 +346,10 @@ fn copy_self_contained_objects(
compiler: &Compiler,
target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> {
@ -38,14 +38,14 @@ index edf18e2ebf33..d48d027f329c 100644
+ return vec![];
+ }
+
let libdir_self_contained = builder.sysroot_libdir(*compiler, target).join("self-contained");
let libdir_self_contained =
builder.sysroot_target_libdir(*compiler, target).join("self-contained");
t!(fs::create_dir_all(&libdir_self_contained));
let mut target_deps = vec![];
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index bdfee55d8d18..47fcd50e7e03 100644
index e706aba977b6..a55d98e94dd8 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -589,6 +589,7 @@ pub struct Target {
@@ -627,6 +627,7 @@ pub struct Target {
pub runner: Option<String>,
pub no_std: bool,
pub codegen_backends: Option<Vec<String>>,
@ -53,9 +53,9 @@ index bdfee55d8d18..47fcd50e7e03 100644
}
impl Target {
@@ -597,6 +598,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true;
@@ -638,6 +639,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("emscripten") {
target.runner = Some("node".into());
}
+ if triple.contains("-musl") || triple.contains("-wasi") || triple.contains("-windows-gnu") {
+ target.self_contained = true;
@ -63,7 +63,7 @@ index bdfee55d8d18..47fcd50e7e03 100644
target
}
}
@@ -1165,6 +1169,7 @@ struct TomlTarget {
@@ -1213,6 +1217,7 @@ struct TomlTarget {
no_std: Option<bool> = "no-std",
codegen_backends: Option<Vec<String>> = "codegen-backends",
runner: Option<String> = "runner",
@ -71,7 +71,7 @@ index bdfee55d8d18..47fcd50e7e03 100644
}
}
@@ -1967,6 +1972,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
@@ -2038,6 +2043,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std {
target.no_std = s;
}
@ -82,10 +82,10 @@ index bdfee55d8d18..47fcd50e7e03 100644
target.cxx = cfg.cxx.map(PathBuf::from);
target.ar = cfg.ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 82b640f54234..f724aba50241 100644
index c384fd6bf435..a101c010b740 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1326,6 +1326,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
@@ -1351,6 +1351,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std)
}
@ -98,5 +98,5 @@ index 82b640f54234..f724aba50241 100644
/// and `remote-test-server` binaries.
fn remote_tested(&self, target: TargetSelection) -> bool {
--
2.46.0
2.47.1

View File

@ -1,162 +0,0 @@
From 65458aed68fe6786068bab00e5a46d7ecdd2a072 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?=
<39484203+jieyouxu@users.noreply.github.com>
Date: Thu, 17 Oct 2024 22:58:45 +0800
Subject: [PATCH] bootstrap: allow setting `--jobs` in config.toml
---
config.example.toml | 5 ++
src/bootstrap/src/core/config/config.rs | 5 +-
src/bootstrap/src/core/config/flags.rs | 3 +-
src/bootstrap/src/core/config/tests.rs | 58 +++++++++++++++++++++++
src/bootstrap/src/utils/change_tracker.rs | 5 ++
5 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/config.example.toml b/config.example.toml
index 4b591b949b36..168ac353cff7 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -414,6 +414,11 @@
# Specify the location of the Android NDK. Used when targeting Android.
#android-ndk = "/path/to/android-ndk-r26d"
+# Number of parallel jobs to be used for building and testing. If set to `0` or
+# omitted, it will be automatically determined. This is the `-j`/`--jobs` flag
+# passed to cargo invocations.
+#jobs = 0
+
# =============================================================================
# General install configuration options
# =============================================================================
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index c2ab439891ea..aeb81b146382 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -891,6 +891,7 @@ struct Build {
metrics: Option<bool> = "metrics",
android_ndk: Option<PathBuf> = "android-ndk",
optimized_compiler_builtins: Option<bool> = "optimized-compiler-builtins",
+ jobs: Option<u32> = "jobs",
}
}
@@ -1289,7 +1290,6 @@ pub(crate) fn parse_inner(
config.rustc_error_format = flags.rustc_error_format;
config.json_output = flags.json_output;
config.on_fail = flags.on_fail;
- config.jobs = Some(threads_from_config(flags.jobs as u32));
config.cmd = flags.cmd;
config.incremental = flags.incremental;
config.dry_run = if flags.dry_run { DryRun::UserSelected } else { DryRun::Disabled };
@@ -1511,8 +1511,11 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
metrics: _,
android_ndk,
optimized_compiler_builtins,
+ jobs,
} = toml.build.unwrap_or_default();
+ config.jobs = Some(threads_from_config(flags.jobs.unwrap_or(jobs.unwrap_or(0))));
+
if let Some(file_build) = build {
config.build = TargetSelection::from_user(&file_build);
};
diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs
index 3aefe517a5be..bfeb811508c0 100644
--- a/src/bootstrap/src/core/config/flags.rs
+++ b/src/bootstrap/src/core/config/flags.rs
@@ -110,11 +110,10 @@ pub struct Flags {
short,
long,
value_hint = clap::ValueHint::Other,
- default_value_t = std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get),
value_name = "JOBS"
)]
/// number of jobs to run in parallel
- pub jobs: usize,
+ pub jobs: Option<u32>,
// This overrides the deny-warnings configuration option,
// which passes -Dwarnings to the compiler invocations.
#[arg(global = true, long)]
diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs
index 2611b6cf51bb..1f02757682c2 100644
--- a/src/bootstrap/src/core/config/tests.rs
+++ b/src/bootstrap/src/core/config/tests.rs
@@ -352,3 +352,61 @@ fn parse_rust_std_features_empty() {
fn parse_rust_std_features_invalid() {
parse("rust.std-features = \"backtrace\"");
}
+
+#[test]
+fn parse_jobs() {
+ assert_eq!(parse("build.jobs = 1").jobs, Some(1));
+}
+
+#[test]
+fn jobs_precedence() {
+ // `--jobs` should take precedence over using `--set build.jobs`.
+
+ let config = Config::parse_inner(
+ Flags::parse(&[
+ "check".to_owned(),
+ "--config=/does/not/exist".to_owned(),
+ "--jobs=67890".to_owned(),
+ "--set=build.jobs=12345".to_owned(),
+ ]),
+ |&_| toml::from_str(""),
+ );
+ assert_eq!(config.jobs, Some(67890));
+
+ // `--set build.jobs` should take precedence over `config.toml`.
+ let config = Config::parse_inner(
+ Flags::parse(&[
+ "check".to_owned(),
+ "--config=/does/not/exist".to_owned(),
+ "--set=build.jobs=12345".to_owned(),
+ ]),
+ |&_| {
+ toml::from_str(
+ r#"
+ [build]
+ jobs = 67890
+ "#,
+ )
+ },
+ );
+ assert_eq!(config.jobs, Some(12345));
+
+ // `--jobs` > `--set build.jobs` > `config.toml`
+ let config = Config::parse_inner(
+ Flags::parse(&[
+ "check".to_owned(),
+ "--jobs=123".to_owned(),
+ "--config=/does/not/exist".to_owned(),
+ "--set=build.jobs=456".to_owned(),
+ ]),
+ |&_| {
+ toml::from_str(
+ r#"
+ [build]
+ jobs = 789
+ "#,
+ )
+ },
+ );
+ assert_eq!(config.jobs, Some(123));
+}
diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs
index b37786496cb5..9169bc90a45d 100644
--- a/src/bootstrap/src/utils/change_tracker.rs
+++ b/src/bootstrap/src/utils/change_tracker.rs
@@ -275,4 +275,9 @@ pub fn human_readable_changes(changes: &[ChangeInfo]) -> String {
severity: ChangeSeverity::Info,
summary: "New option `./x setup editor` added, replacing `./x setup vscode` and adding support for vim, emacs and helix.",
},
+ ChangeInfo {
+ change_id: 131838,
+ severity: ChangeSeverity::Info,
+ summary: "Allow setting `--jobs` in config.toml with `build.jobs`.",
+ },
];
--
2.47.0

View File

@ -1,4 +1,4 @@
From 3fdce19416e80a48c5b2b77b2cdec697d0b5e225 Mon Sep 17 00:00:00 2001
From 21d53eca2af5f04c0aa6b898f99f58e0e093cfdd Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi
@ -10,10 +10,10 @@ Subject: [PATCH 2/2] set an external library path for wasm32-wasi
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index e8143b9a5f38..5a928a18b3ea 100644
index 5149e3a12f23..cf62fbdc7f59 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1621,6 +1621,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
@@ -1663,6 +1663,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path;
}
}
@ -23,10 +23,10 @@ index e8143b9a5f38..5a928a18b3ea 100644
+ return file_path;
+ }
+ }
for search_path in sess.target_filesearch(PathKind::Native).search_paths() {
for search_path in sess.target_filesearch().search_paths(PathKind::Native) {
let file_path = search_path.dir.join(name);
if file_path.exists() {
@@ -2123,6 +2129,10 @@ fn add_library_search_dirs(
@@ -2163,6 +2169,10 @@ fn add_library_search_dirs(
ControlFlow::<()>::Continue(())
},
);
@ -38,10 +38,10 @@ index e8143b9a5f38..5a928a18b3ea 100644
/// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index d5f227a84a4c..54c22c8ebed6 100644
index 321ab40403a3..54791c8892d8 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -2053,6 +2053,7 @@ pub struct TargetOptions {
@@ -2155,6 +2155,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
@ -49,7 +49,7 @@ index d5f227a84a4c..54c22c8ebed6 100644
/// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled.
pub pre_link_objects_self_contained: CrtObjects,
pub post_link_objects_self_contained: CrtObjects,
@@ -2540,6 +2541,7 @@ fn default() -> TargetOptions {
@@ -2651,6 +2652,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),
@ -57,7 +57,7 @@ index d5f227a84a4c..54c22c8ebed6 100644
pre_link_objects_self_contained: Default::default(),
post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False,
@@ -3221,6 +3223,7 @@ macro_rules! key {
@@ -3355,6 +3357,7 @@ macro_rules! key {
key!(linker_is_gnu_json = "linker-is-gnu", bool);
key!(pre_link_objects = "pre-link-objects", link_objects);
key!(post_link_objects = "post-link-objects", link_objects);
@ -65,7 +65,7 @@ index d5f227a84a4c..54c22c8ebed6 100644
key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects);
key!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects);
// Deserializes the backwards-compatible variants of `-Clink-self-contained`
@@ -3482,6 +3485,7 @@ macro_rules! target_option_val {
@@ -3636,6 +3639,7 @@ macro_rules! target_option_val {
target_option_val!(linker_is_gnu_json, "linker-is-gnu");
target_option_val!(pre_link_objects);
target_option_val!(post_link_objects);
@ -74,12 +74,12 @@ index d5f227a84a4c..54c22c8ebed6 100644
target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback");
target_option_val!(link_args - pre_link_args_json, "pre-link-args");
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
index 29e6dff2068f..dbe021ef064c 100644
index 1cd30f21bec1..9a752d5712a6 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -19,11 +19,12 @@ pub fn target() -> Target {
@@ -19,11 +19,12 @@ pub(crate) fn target() -> Target {
options.env = "p1".into();
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]);
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasip1"]);
- options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
- options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@ -94,5 +94,5 @@ index 29e6dff2068f..dbe021ef064c 100644
// Right now this is a bit of a workaround but we're currently saying that
// the target by default has a static crt which we're taking as a signal
--
2.46.0
2.47.1

View File

@ -254,3 +254,4 @@ set -euo pipefail\
> cargo-vendor.txt \
}\
)

View File

@ -22,3 +22,4 @@ unicode:
- rustc-*-src/vendor/wast-*/tests/parse-fail/confusing-block-comment?.wat
- rustc-*-src/vendor/wast-*/tests/parse-fail/confusing-line-comment?.wat
- rustc-*-src/src/llvm-project/clang-tools-extra/docs/clang-tidy/checks/misc/misleading-bidirectional.rst
- rustc-*-src/src/gcc/gcc/testsuite/c-c++-common/*Wbidi*.c

174
rust.spec
View File

@ -1,5 +1,5 @@
Name: rust
Version: 1.83.0
Version: 1.84.1
Release: %autorelease
Summary: The Rust Programming Language
License: (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-DFS-2016)
@ -14,9 +14,9 @@ ExclusiveArch: %{rust_arches}
# To bootstrap from scratch, set the channel and date from src/stage0.json
# e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13
# or nightly wants some beta-YYYY-MM-DD
%global bootstrap_version 1.82.0
%global bootstrap_channel 1.82.0
%global bootstrap_date 2024-10-17
%global bootstrap_version 1.83.0
%global bootstrap_channel 1.83.0
%global bootstrap_date 2024-11-28
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -25,40 +25,10 @@ ExclusiveArch: %{rust_arches}
# add them to sources. Remember to remove them again after the bootstrap build!
#global bootstrap_arches %%{rust_arches}
# Define a space-separated list of targets to ship rust-std-static-$triple for
# cross-compilation. The packages are noarch, but they're not fully
# reproducible between hosts, so only x86_64 actually builds it.
%ifarch x86_64
%if 0%{?fedora}
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
%endif
# NB: wasm32-wasi is being gradually replaced by wasm32-wasip1
# https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
%global wasm_targets wasm32-unknown-unknown wasm32-wasi wasm32-wasip1
%if 0%{?fedora}
%global extra_targets x86_64-unknown-none x86_64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets x86_64-unknown-none
%endif
%endif
%ifarch aarch64
%if 0%{?fedora}
%global extra_targets aarch64-unknown-none-softfloat aarch64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets aarch64-unknown-none-softfloat
%endif
%endif
%global all_targets %{?mingw_targets} %{?wasm_targets} %{?extra_targets}
%define target_enabled() %{lua:
print(string.find(rpm.expand(" %{all_targets} "), rpm.expand(" %1 "), 1, true) or 0)
}
# We need CRT files for *-wasi targets, at least as new as the commit in
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
%global wasi_libc_url https://github.com/WebAssembly/wasi-libc
%global wasi_libc_ref wasi-sdk-24
%global wasi_libc_ref wasi-sdk-25
%global wasi_libc_name wasi-libc-%{wasi_libc_ref}
%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz
%global wasi_libc_dir %{_builddir}/%{wasi_libc_name}
@ -74,7 +44,7 @@ ExclusiveArch: %{rust_arches}
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 18.0+.
%global min_llvm_version 18.0.0
%global bundled_llvm_version 19.1.1
%global bundled_llvm_version 19.1.5
#global llvm_compat_version 17
%global llvm llvm%{?llvm_compat_version}
%bcond_with bundled_llvm
@ -90,6 +60,15 @@ ExclusiveArch: %{rust_arches}
%bcond_without bundled_libgit2
%endif
# Try to use system oniguruma (only used at build time for rust-docs)
# src/tools/rustbook -> ... -> onig_sys v69.8.1 needs at least 6.9.3
%global min_oniguruma_version 6.9.3
%if 0%{?rhel} && 0%{?rhel} < 9
%bcond_without bundled_oniguruma
%else
%bcond_with bundled_oniguruma
%endif
# Cargo uses UPSERTs with omitted conflict targets
%global min_sqlite3_version 3.35
%global bundled_sqlite3_version 3.46.0
@ -158,10 +137,10 @@ Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch
Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch
# We don't want to use the bundled library in libsqlite3-sys
Patch6: rustc-1.82.0-unbundle-sqlite.patch
Patch6: rustc-1.84.0-unbundle-sqlite.patch
# https://github.com/rust-lang/rust/pull/131838
Patch7: 0001-bootstrap-allow-setting-jobs-in-config.toml.patch
# https://github.com/rust-lang/cc-rs/issues/1354
Patch7: 0001-Only-translate-profile-flags-for-Clang.patch
### RHEL-specific patches below ###
@ -172,31 +151,60 @@ Source102: cargo_vendor.attr
Source103: cargo_vendor.prov
# Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949)
Patch100: rustc-1.82.0-disable-libssh2.patch
Patch100: rustc-1.84.0-disable-libssh2.patch
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
local abi = "gnu"
# Get the Rust triple for any architecture and ABI.
%{lua: function rust_triple(arch, abi)
abi = abi or "gnu"
if arch == "armv7hl" then
arch = "armv7"
abi = "gnueabihf"
elseif arch == "ppc64" then
arch = "powerpc64"
abi = abi.."eabihf"
elseif arch == "ppc64le" then
arch = "powerpc64le"
elseif arch == "riscv64" then
arch = "riscv64gc"
elseif arch == "x86_64_v2" then
elseif arch == "x86_64_v2" then
arch = "x86_64"
end
return arch.."-unknown-linux-"..abi
end}
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
%define rust_triple() %{lua: print(rust_triple(
rpm.expand("%{?1}%{!?1:%{_target_cpu}}"),
rpm.expand("%{?2}%{!?2:gnu}")
))}
# Get the environment form of the Rust triple
%global rust_triple_env %{lua:
print(string.upper(string.gsub(rpm.expand("%{rust_triple}"), "-", "_")))
# Get the environment variable form of the Rust triple.
%define rust_triple_env() %{lua:
print(rpm.expand("%{rust_triple %*}"):gsub("-", "_"):upper())
}
# Define a space-separated list of targets to ship rust-std-static-$triple for
# cross-compilation. The packages are noarch, but they're not fully
# reproducible between hosts, so only x86_64 actually builds it.
%ifarch x86_64
%if 0%{?fedora}
%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu
%endif
%global wasm_targets wasm32-unknown-unknown wasm32-wasip1
%if 0%{?fedora}
%global extra_targets x86_64-unknown-none x86_64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets x86_64-unknown-none
%endif
%endif
%ifarch aarch64
%if 0%{?fedora}
%global extra_targets aarch64-unknown-none-softfloat aarch64-unknown-uefi
%endif
%if 0%{?rhel} >= 10
%global extra_targets aarch64-unknown-none-softfloat
%endif
%endif
%global all_targets %{?mingw_targets} %{?wasm_targets} %{?extra_targets}
%define target_enabled() %{lua:
print(string.find(rpm.expand(" %{all_targets} "), rpm.expand(" %1 "), 1, true) or 0)
}
%if %defined bootstrap_arches
@ -230,7 +238,7 @@ end}
%global local_rust_root %{_builddir}/rust-%{bootstrap_suffix}
Provides: bundled(%{name}-bootstrap) = %{bootstrap_version}
%else
BuildRequires: cargo >= %{bootstrap_version}
BuildRequires: (cargo >= %{bootstrap_version} with cargo <= %{version})
BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version})
%global local_rust_root %{_prefix}
%endif
@ -250,6 +258,10 @@ BuildRequires: pkgconfig(zlib)
BuildRequires: (pkgconfig(libgit2) >= %{min_libgit2_version} with pkgconfig(libgit2) < %{next_libgit2_version})
%endif
%if %{without bundled_oniguruma}
BuildRequires: pkgconfig(oniguruma) >= %{min_oniguruma_version}
%endif
%if %{without bundled_sqlite3}
BuildRequires: pkgconfig(sqlite3) >= %{min_sqlite3_version}
%endif
@ -430,18 +442,6 @@ BuildArch: noarch
%target_description wasm32-unknown-unknown WebAssembly
%endif
%if %target_enabled wasm32-wasi
%target_package wasm32-wasi
Requires: lld >= 8.0
%if %with bundled_wasi_libc
Provides: bundled(wasi-libc)
%else
Requires: wasi-libc-static
%endif
BuildArch: noarch
%target_description wasm32-wasi WebAssembly
%endif
%if %target_enabled wasm32-wasip1
%target_package wasm32-wasip1
Requires: lld >= 8.0
@ -451,6 +451,8 @@ Provides: bundled(wasi-libc)
Requires: wasi-libc-static
%endif
BuildArch: noarch
# https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
Obsoletes: %{name}-std-static-wasm32-wasi < 1.84.0~
%target_description wasm32-wasip1 WebAssembly
%endif
@ -671,7 +673,7 @@ rm -rf %{wasi_libc_dir}/dlmalloc/
%if %without bundled_sqlite3
%patch -P6 -p1
%endif
%patch -P7 -p1
%patch -P7 -p1 -d vendor/cc-1.2.5
%if %with disabled_libssh2
%patch -P100 -p1
@ -688,6 +690,10 @@ rm -rf src/llvm-project/
mkdir -p src/llvm-project/libunwind/
%endif
# Remove submodules we don't need.
rm -rf src/gcc
rm -rf src/tools/enzyme
rm -rf src/tools/rustc-perf
# Remove other unused vendored libraries. This leaves the directory in place,
# because some build scripts watch them, e.g. "cargo:rerun-if-changed=curl".
@ -706,6 +712,10 @@ mkdir -p src/llvm-project/libunwind/
%clear_dir vendor/libgit2-sys*/libgit2/
%endif
%if %without bundled_oniguruma
%clear_dir vendor/onig_sys*/oniguruma/
%endif
%if %without bundled_sqlite3
%clear_dir vendor/libsqlite3-sys*/sqlite3/
%endif
@ -767,12 +777,12 @@ end}
end}
%endif
# Set up shared environment variables for build/install/check.
# *_USE_PKG_CONFIG=1 convinces *-sys crates to use the system library.
%global rust_env %{shrink:
%{?rustflags:RUSTFLAGS="%{rustflags}"}
%{rustc_target_cpus}
%{!?with_bundled_oniguruma:RUSTONIG_SYSTEM_LIBONIG=1}
%{!?with_bundled_sqlite3:LIBSQLITE3_SYS_USE_PKG_CONFIG=1}
%{!?with_disabled_libssh2:LIBSSH2_SYS_USE_PKG_CONFIG=1}
}
@ -818,16 +828,12 @@ end}
%if %defined wasm_targets
%if %with bundled_wasi_libc
%define wasi_libc_flags MALLOC_IMPL=emmalloc CC=clang AR=llvm-ar NM=llvm-nm
%make_build --quiet -C %{wasi_libc_dir} %{wasi_libc_flags} TARGET_TRIPLE=wasm32-wasi
%make_build --quiet -C %{wasi_libc_dir} %{wasi_libc_flags} TARGET_TRIPLE=wasm32-wasip1
%define wasm_target_config %{shrink:
--set target.wasm32-wasi.wasi-root=%{wasi_libc_dir}/sysroot
--set target.wasm32-wasip1.wasi-root=%{wasi_libc_dir}/sysroot
}
%else
%define wasm_target_config %{shrink:
--set target.wasm32-wasi.wasi-root=%{_prefix}/wasm32-wasi
--set target.wasm32-wasi.self-contained=false
--set target.wasm32-wasip1.wasi-root=%{_prefix}/wasm32-wasi
--set target.wasm32-wasip1.self-contained=false
}
@ -839,12 +845,7 @@ end}
# clang_resource_dir is not defined for compat builds.
%define profiler /usr/lib/clang/%{llvm_compat_version}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
%else
%if 0%{?clang_major_version} >= 17
%define profiler %{clang_resource_dir}/lib/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
%else
# The exact profiler path is version dependent..
%define profiler %(echo %{_libdir}/clang/??/lib/libclang_rt.profile-*.a)
%endif
%endif
test -r "%{profiler}"
@ -878,6 +879,7 @@ test -r "%{profiler}"
--set build.install-stage=2 \
--set build.test-stage=2 \
--set build.optimized-compiler-builtins=false \
--set rust.llvm-tools=false \
--enable-extended \
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--enable-vendor \
@ -935,7 +937,7 @@ rm -rf ./build/dist/ ./build/tmp/
# Some of the components duplicate-install binaries, leaving backups we don't want
rm -f %{buildroot}%{_bindir}/*.old
# Make sure the shared libraries are in the proper libdir
# Make sure the compiler's shared libraries are in the proper libdir
%if "%{_libdir}" != "%{common_libdir}"
mkdir -p %{buildroot}%{_libdir}
find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
@ -946,6 +948,13 @@ find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
-exec chmod -v +x '{}' '+'
# The shared standard library is excluded from Provides, because it has no
# stable ABI. However, we still ship it alongside the static target libraries
# to enable some niche local use-cases, like the `evcxr` REPL.
# Make sure those libraries are also executable for debuginfo extraction.
find %{buildroot}%{rustlibdir} -type f -name '*.so' \
-exec chmod -v +x '{}' '+'
# Remove installer artifacts (manifests, uninstall scripts, etc.)
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
@ -1048,7 +1057,7 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%doc README.md
%{_bindir}/rustc
%{_bindir}/rustdoc
%{_libdir}/*.so
%{_libdir}/librustc_driver-*.so
%{_libexecdir}/rust-analyzer-proc-macro-srv
%{_mandir}/man1/rustc.1*
%{_mandir}/man1/rustdoc.1*
@ -1059,7 +1068,7 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.rlib
%exclude %{rustlibdir}/%{rust_triple}/lib/*.so
%{rustlibdir}/%{rust_triple}/lib/*.so
%global target_files() \
%files std-static-%1 \
@ -1086,15 +1095,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%target_files wasm32-unknown-unknown
%endif
%if %target_enabled wasm32-wasi
%target_files wasm32-wasi
%if %with bundled_wasi_libc
%dir %{rustlibdir}/wasm32-wasi/lib/self-contained
%{rustlibdir}/wasm32-wasi/lib/self-contained/crt*.o
%{rustlibdir}/wasm32-wasi/lib/self-contained/libc.a
%endif
%endif
%if %target_enabled wasm32-wasip1
%target_files wasm32-wasip1
%if %with bundled_wasi_libc

View File

@ -1,7 +1,7 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:36:55.743405666 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:36:55.745405652 -0700
@@ -2156,7 +2156,6 @@ checksum = "10472326a8a6477c3c20a64547b0
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-12-12 14:07:10.755481543 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-12-12 14:07:10.756481534 -0800
@@ -2272,7 +2272,6 @@ checksum = "10472326a8a6477c3c20a64547b0
dependencies = [
"cc",
"libc",
@ -9,7 +9,7 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2197,20 +2196,6 @@ dependencies = [
@@ -2313,20 +2312,6 @@ dependencies = [
"pkg-config",
"vcpkg",
]
@ -31,14 +31,14 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools
[[package]]
name = "libz-sys"
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-09-06 10:36:55.746405645 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:37:13.849280464 -0700
@@ -44,7 +44,7 @@ curl = "0.4.46"
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-12-12 14:07:10.756481534 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-12-12 14:07:56.866087428 -0800
@@ -47,7 +47,7 @@ curl = "0.4.46"
curl-sys = "0.4.73"
filetime = "0.2.23"
flate2 = { version = "1.0.30", default-features = false, features = ["zlib"] }
-git2 = "0.19.0"
+git2 = { version = "0.19.0", default-features = false, features = ["https"] }
git2-curl = "0.20.0"
gix = { version = "0.64.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }
gix = { version = "0.67.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }
glob = "0.3.1"

View File

@ -1,7 +1,7 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:30:29.435107742 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:31:57.168492758 -0700
@@ -2194,7 +2194,6 @@ version = "0.30.1"
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-12-07 06:47:38.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-12-12 14:02:54.412672539 -0800
@@ -2310,7 +2310,6 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
dependencies = [
@ -10,14 +10,14 @@ diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools
"vcpkg",
]
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-09-06 10:30:29.435107742 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:31:27.942697616 -0700
@@ -77,7 +77,7 @@ proptest = "1.5.0"
pulldown-cmark = { version = "0.11.0", default-features = false, features = ["html"] }
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-12-12 14:02:54.412672539 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-12-12 14:03:25.665405417 -0800
@@ -80,7 +80,7 @@ proptest = "1.5.0"
pulldown-cmark = { version = "0.12.0", default-features = false, features = ["html"] }
rand = "0.8.5"
regex = "1.10.5"
-rusqlite = { version = "0.32.0", features = ["bundled"] }
+rusqlite = { version = "0.32.0", features = [] }
rustfix = { version = "0.8.2", path = "crates/rustfix" }
rustc-hash = "2.0.0"
rustfix = { version = "0.9.0", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.11.1"

View File

@ -1,2 +1,2 @@
SHA512 (rustc-1.83.0-src.tar.xz) = 64db57949c6ac1df6a3f4c6bd0938685a5fb1bc3d318b34ccfcfccb0f9eff1cffd4d8a53a190ef0409eeca9ad12bc6234c2c1de69196cc74ae02d6afa20d0ce6
SHA512 (wasi-libc-wasi-sdk-24.tar.gz) = ab9322dbcd0bb151ba3f5a8b722e04d39ea5d7632d0322257c3b67e4193d0de1b0820dd4db84923e7967f24189d02dd242693ea95ad184a309eec4d27df8ba21
SHA512 (rustc-1.84.1-src.tar.xz) = f1cc4765736551508408126e44086988e8ddc30c1a929bf7b61c6be85ad0d65928dd5fb1041cfaeee8eb37d2208f2c1917e276aef2bc9a8e40e34f6713b349e1
SHA512 (wasi-libc-wasi-sdk-25.tar.gz) = 580716fbc152be19e2e9724f3483a0a580a168be0cd6d105d37b0ebd0d11bd36d7d9db63984eb2cc7b3aaff2fc9446d9558d1469b538a79b7de465a1113560ea