Compare commits

..

No commits in common. "rawhide" and "f38" have entirely different histories.

40 changed files with 1966 additions and 588 deletions

25
.gitignore vendored
View file

@ -435,28 +435,3 @@
/rustc-1.77.0-src.tar.xz
/rustc-1.77.2-src.tar.xz
/rustc-1.78.0-src.tar.xz
/rustc-1.79.0-src.tar.xz
/wasi-libc-wasi-sdk-22.tar.gz
/rustc-1.80.0-src.tar.xz
/rustc-1.80.1-src.tar.xz
/wasi-libc-3f43ea9abb24ed8d24d760989e1d87ea385f8eaa.tar.gz
/rustc-1.81.0-src.tar.xz
/wasi-libc-b9ef79d7dbd47c6c5bafdae760823467c2f60b70.tar.gz
/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
/rustc-1.85.0-src.tar.xz
/rustc-1.85.1-src.tar.xz
/rustc-1.86.0-src.tar.xz
/wasi-libc-640c0cfc19a96b099e0791824be5ef0105ce2084.tar.gz
/rustc-1.87.0-src.tar.xz
/rustc-1.88.0-src.tar.xz
/wasi-libc-wasi-sdk-27.tar.gz
/rustc-1.89.0-src.tar.xz
/rustc-1.90.0-src.tar.xz
/rustc-1.91.0-src.tar.xz
/rustc-1.91.1-src.tar.xz
/rustc-1.92.0-src.tar.xz

View file

@ -0,0 +1,59 @@
From 6dda4e006b0d6d7519ac4a9f540566c81e406a8b Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 22 Apr 2024 16:19:17 -0700
Subject: [PATCH] Fix 2 tests for offline execution
In `alt_registry::warn_for_unused_fields`, the second part of the test
runs on `--registry crates-io`, so it needs a local replacement url.
In `install::install_global_cargo_config`, it was adding to the "config"
file, but the `pkg` before it configured the dummy registry replacement
in "config.toml". So that replacement wasn't actually used, and if you
ran tests online it was trying to install `bar v0.1.1` from the real
registry! The filename is now fixed, and the test double-checks that
we're only trying to install the local `bar v0.0.1`.
---
tests/testsuite/alt_registry.rs | 4 ++++
tests/testsuite/install.rs | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs
index e95f2cbaabbd..1fef04e3ae42 100644
--- a/tests/testsuite/alt_registry.rs
+++ b/tests/testsuite/alt_registry.rs
@@ -1572,7 +1572,11 @@ or use environment variable CARGO_REGISTRIES_ALTERNATIVE_TOKEN",
)
.run();
+ let crates_io = registry::RegistryBuilder::new()
+ .no_configure_token()
+ .build();
p.cargo("publish --registry crates-io")
+ .replace_crates_io(crates_io.index_url())
.with_status(101)
.with_stderr(
"\
diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs
index 89d40ada9543..ef3f4f3ae604 100644
--- a/tests/testsuite/install.rs
+++ b/tests/testsuite/install.rs
@@ -1981,7 +1981,7 @@ fn install_ignores_unstable_table_in_local_cargo_config() {
fn install_global_cargo_config() {
pkg("bar", "0.0.1");
- let config = cargo_home().join("config");
+ let config = cargo_home().join("config.toml");
let mut toml = fs::read_to_string(&config).unwrap_or_default();
toml.push_str(
@@ -1994,6 +1994,7 @@ fn install_global_cargo_config() {
cargo_process("install bar")
.with_status(101)
+ .with_stderr_contains("[INSTALLING] bar v0.0.1")
.with_stderr_contains("[..]--target nonexistent[..]")
.run();
}
--
2.44.0

View file

@ -0,0 +1,49 @@
From f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 8 Apr 2024 15:04:44 -0700
Subject: [PATCH] Fix UI tests with dist-vendored dependencies
There is already a workaround in `compiletest` to deal with custom
`CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`.
A similar need exists when dependencies come from the local `vendor`
directory, which distro builds often use, so now we ignore that too.
Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably
expecting a version suffix, but the vendored path doesn't include the
version. Now that matches `[\\/]hashbrown` instead.
---
src/tools/compiletest/src/runtest.rs | 5 +++++
tests/ui/issues/issue-21763.rs | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index bb8509fe4137..770496289e2e 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2354,6 +2354,11 @@ fn make_compile_args(
"ignore-directory-in-diagnostics-source-blocks={}",
home::cargo_home().expect("failed to find cargo home").to_str().unwrap()
));
+ // Similarly, vendored sources shouldn't be shown when running from a dist tarball.
+ rustc.arg("-Z").arg(format!(
+ "ignore-directory-in-diagnostics-source-blocks={}",
+ self.config.find_rust_src_root().unwrap().join("vendor").display(),
+ ));
// Optionally prevent default --sysroot if specified in test compile-flags.
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))
diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs
index a349253063c0..1d0a0705cbbd 100644
--- a/tests/ui/issues/issue-21763.rs
+++ b/tests/ui/issues/issue-21763.rs
@@ -1,6 +1,6 @@
// Regression test for HashMap only impl'ing Send/Sync if its contents do
-//@ normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION"
+//@ normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION"
use std::collections::HashMap;
use std::rc::Rc;
--
2.44.0

View file

@ -1,4 +1,4 @@
From e54c0a4cc8bd8a76b155714b23a61d1d32a8d069 Mon Sep 17 00:00:00 2001
From 184d61d2c12aa2db01de9a14ccb2be0cfae5039b 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
@ -10,12 +10,12 @@ Subject: [PATCH] Let environment variables override some default CPUs
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
index 9e406af53b5..9104903673f 100644
index 194c3170e683..9806ca78297c 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
@@ -4,7 +4,7 @@
@@ -2,7 +2,7 @@
pub(crate) fn target() -> Target {
pub fn target() -> Target {
let mut base = base::linux_gnu::opts();
- base.cpu = "ppc64le".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_PPC64LE").unwrap_or("ppc64le").into();
@ -23,25 +23,25 @@ index 9e406af53b5..9104903673f 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 cdcf7d62a3e..02f24274ed2 100644
index 6fc410eb2235..c8f84edb9715 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
@@ -6,7 +6,7 @@ pub(crate) fn target() -> Target {
@@ -5,7 +5,7 @@ pub fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.endian = Endian::Big;
// z10 is the oldest CPU supported by LLVM
- base.cpu = "z10".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_S390X").unwrap_or("z10").into();
base.max_atomic_width = Some(128);
base.min_global_align = Some(Align::from_bits(16).unwrap());
base.stack_probes = StackProbeType::Inline;
// FIXME: The ABI implementation in cabi_s390x.rs is for now hard-coded to assume the no-vector
// ABI. Pass the -vector feature string to LLVM to respect this assumption. On LLVM < 16, we
// also strip v128 from the data_layout below to match the older LLVM's expectation.
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 0c8353fad18..c2515e700bb 100644
index 80e267c163fa..8436a00e66d5 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
@@ -4,7 +4,7 @@
@@ -2,7 +2,7 @@
pub(crate) fn target() -> Target {
pub fn target() -> Target {
let mut base = base::linux_gnu::opts();
- base.cpu = "x86-64".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_X86_64").unwrap_or("x86-64").into();
@ -49,5 +49,5 @@ index 0c8353fad18..c2515e700bb 100644
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
--
2.49.0
2.41.0

View file

@ -0,0 +1,79 @@
From 27593a7ad3796cf3afaf4145275ff20d5aff333f Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Wed, 10 Apr 2024 17:25:10 -0700
Subject: [PATCH 1/2] Set the host library path in run-make v2
When the build is configured with `[rust] rpath = false`, we need to set
`LD_LIBRARY_PATH` (or equivalent) to what would have been the `RPATH`,
so the compiler can find its own libraries. The old `tools.mk` code has
this environment prefixed in the `$(BARE_RUSTC)` variable, so we just
need to wire up something similar for run-make v2.
This is now set while building each `rmake.rs` itself, as well as in the
`rust-make-support` helpers for `rustc` and `rustdoc` commands. This is
also available in a `set_host_rpath` function for manual commands, like
in the `compiler-builtins` test.
(cherry picked from commit 8a5409bbdbadb522f25e7e5e3d54b967cb5eee56)
---
src/tools/compiletest/src/runtest.rs | 6 ++++++
src/tools/run-make-support/src/lib.rs | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 7be0571b1111..3c775ea0651c 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -3767,6 +3767,11 @@ fn run_rmake_v2_test(&self) {
debug!(?support_lib_deps);
debug!(?support_lib_deps_deps);
+ let mut host_dylib_env_paths = String::new();
+ host_dylib_env_paths.push_str(&cwd.join(&self.config.compile_lib_path).to_string_lossy());
+ host_dylib_env_paths.push(':');
+ host_dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
+
let res = self.cmd2procres(
Command::new(&self.config.rustc_path)
.arg("-o")
@@ -3787,6 +3792,7 @@ fn run_rmake_v2_test(&self) {
.env("RUSTC", cwd.join(&self.config.rustc_path))
.env("TMPDIR", &tmpdir)
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
+ .env(dylib_env_var(), &host_dylib_env_paths)
.env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))
.env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path))
.env("LLVM_COMPONENTS", &self.config.llvm_components)
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index 674860f8413b..da3efd292b3f 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -11,6 +11,7 @@ pub fn out_dir() -> PathBuf {
fn setup_common_build_cmd() -> Command {
let rustc = env::var("RUSTC").unwrap();
let mut cmd = Command::new(rustc);
+ set_host_rpath(&mut cmd);
cmd.arg("--out-dir").arg(out_dir()).arg("-L").arg(out_dir());
cmd
}
@@ -157,3 +158,17 @@ pub fn run_fail(bin_name: &str) -> Output {
}
output
}
+
+/// Set the runtime library path as needed for running the host rustc/rustdoc/etc.
+pub fn set_host_rpath(cmd: &mut Command) {
+ let ld_lib_path_envvar = env::var("LD_LIB_PATH_ENVVAR").unwrap();
+ cmd.env(&ld_lib_path_envvar, {
+ let mut paths = vec![];
+ paths.push(PathBuf::from(env::var("TMPDIR").unwrap()));
+ paths.push(PathBuf::from(env::var("HOST_RPATH_DIR").unwrap()));
+ for p in env::split_paths(&env::var(&ld_lib_path_envvar).unwrap()) {
+ paths.push(p.to_path_buf());
+ }
+ env::join_paths(paths.iter()).unwrap()
+ });
+}
--
2.44.0

View file

@ -0,0 +1,232 @@
From 245fbeef49c2395471498d20e67f4edf4222c865 Mon Sep 17 00:00:00 2001
From: Josh Stone <cuviper@gmail.com>
Date: Tue, 16 Apr 2024 16:45:59 -0700
Subject: [PATCH] The `multiple_unsafe_ops_per_block` test needs `asm!`
---
tests/ui/multiple_unsafe_ops_per_block.rs | 1 +
tests/ui/multiple_unsafe_ops_per_block.stderr | 58 +++++++++----------
2 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/tests/ui/multiple_unsafe_ops_per_block.rs b/tests/ui/multiple_unsafe_ops_per_block.rs
index 8afb4df20af4..6b8a103d4a94 100644
--- a/tests/ui/multiple_unsafe_ops_per_block.rs
+++ b/tests/ui/multiple_unsafe_ops_per_block.rs
@@ -1,3 +1,4 @@
+//@needs-asm-support
//@aux-build:proc_macros.rs
#![allow(unused)]
#![allow(deref_nullptr)]
diff --git a/tests/ui/multiple_unsafe_ops_per_block.stderr b/tests/ui/multiple_unsafe_ops_per_block.stderr
index cff85ae115e0..e732bde0707e 100644
--- a/tests/ui/multiple_unsafe_ops_per_block.stderr
+++ b/tests/ui/multiple_unsafe_ops_per_block.stderr
@@ -1,5 +1,5 @@
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:36:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:37:5
|
LL | / unsafe {
LL | | STATIC += 1;
@@ -8,12 +8,12 @@ LL | | }
| |_____^
|
note: modification of a mutable static occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:37:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:38:9
|
LL | STATIC += 1;
| ^^^^^^^^^^^
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:38:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:39:9
|
LL | not_very_safe();
| ^^^^^^^^^^^^^^^
@@ -21,7 +21,7 @@ LL | not_very_safe();
= help: to override `-D warnings` add `#[allow(clippy::multiple_unsafe_ops_per_block)]`
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:45:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:46:5
|
LL | / unsafe {
LL | | drop(u.u);
@@ -30,18 +30,18 @@ LL | | }
| |_____^
|
note: union field access occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:46:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:47:14
|
LL | drop(u.u);
| ^^^
note: raw pointer dereference occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:47:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:48:9
|
LL | *raw_ptr();
| ^^^^^^^^^^
error: this `unsafe` block contains 3 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:52:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:53:5
|
LL | / unsafe {
LL | | asm!("nop");
@@ -51,23 +51,23 @@ LL | | }
| |_____^
|
note: inline assembly used here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:53:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:54:9
|
LL | asm!("nop");
| ^^^^^^^^^^^
note: unsafe method call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:54:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:55:9
|
LL | sample.not_very_safe();
| ^^^^^^^^^^^^^^^^^^^^^^
note: modification of a mutable static occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:55:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:56:9
|
LL | STATIC = 0;
| ^^^^^^^^^^
error: this `unsafe` block contains 6 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:61:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:62:5
|
LL | / unsafe {
LL | | drop(u.u);
@@ -79,55 +79,55 @@ LL | | }
| |_____^
|
note: union field access occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:62:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:63:14
|
LL | drop(u.u);
| ^^^
note: access of a mutable static occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:63:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:64:14
|
LL | drop(STATIC);
| ^^^^^^
note: unsafe method call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:64:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:65:9
|
LL | sample.not_very_safe();
| ^^^^^^^^^^^^^^^^^^^^^^
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:65:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:66:9
|
LL | not_very_safe();
| ^^^^^^^^^^^^^^^
note: raw pointer dereference occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:66:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:67:9
|
LL | *raw_ptr();
| ^^^^^^^^^^
note: inline assembly used here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:67:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:68:9
|
LL | asm!("nop");
| ^^^^^^^^^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:105:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:106:5
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:105:14
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:106:14
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: raw pointer dereference occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:105:39
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:106:39
|
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
| ^^^^^^^^^^^^^^^^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:123:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:124:5
|
LL | / unsafe {
LL | | x();
@@ -136,18 +136,18 @@ LL | | }
| |_____^
|
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:124:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:125:9
|
LL | x();
| ^^^
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:125:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:126:9
|
LL | x();
| ^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:134:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:135:9
|
LL | / unsafe {
LL | | T::X();
@@ -156,18 +156,18 @@ LL | | }
| |_________^
|
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:135:13
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:136:13
|
LL | T::X();
| ^^^^^^
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:136:13
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:137:13
|
LL | T::X();
| ^^^^^^
error: this `unsafe` block contains 2 unsafe operations, expected only one
- --> tests/ui/multiple_unsafe_ops_per_block.rs:144:5
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:145:5
|
LL | / unsafe {
LL | | x.0();
@@ -176,12 +176,12 @@ LL | | }
| |_____^
|
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:145:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:146:9
|
LL | x.0();
| ^^^^^
note: unsafe function call occurs here
- --> tests/ui/multiple_unsafe_ops_per_block.rs:146:9
+ --> tests/ui/multiple_unsafe_ops_per_block.rs:147:9
|
LL | x.0();
| ^^^^^
--
2.44.0

View file

@ -0,0 +1,264 @@
From 706f06c39a9e08a4708a53722429d13ae4069c2f Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Wed, 1 May 2024 15:25:26 -0700
Subject: [PATCH] Use an explicit x86-64 cpu in tests that are sensitive to it
There are a few tests that depend on some target features **not** being
enabled by default, and usually they are correct with the default x86-64
target CPU. However, in downstream builds we have modified the default
to fit our distros -- `x86-64-v2` in RHEL 9 and `x86-64-v3` in RHEL 10
-- and the latter especially trips tests that expect not to have AVX.
These cases are few enough that we can just set them back explicitly.
---
tests/assembly/simd-intrinsic-mask-reduce.rs | 1 +
tests/assembly/x86_64-floating-point-clamp.rs | 2 +-
.../codegen/target-feature-inline-closure.rs | 2 +-
tests/ui/asm/x86_64/target-feature-attr.rs | 1 +
.../ui/asm/x86_64/target-feature-attr.stderr | 8 +++---
.../const-eval/const_fn_target_feature.rs | 2 +-
.../rfc-2396-target_feature-11/safe-calls.rs | 1 +
.../safe-calls.stderr | 28 +++++++++----------
tests/ui/sse2.rs | 4 +--
9 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs
index 763401755fad..0d77fc410511 100644
--- a/tests/assembly/simd-intrinsic-mask-reduce.rs
+++ b/tests/assembly/simd-intrinsic-mask-reduce.rs
@@ -1,6 +1,7 @@
// verify that simd mask reductions do not introduce additional bit shift operations
//@ revisions: x86 aarch64
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
+//@ [x86] compile-flags: -C target-cpu=x86-64
//@ [x86] needs-llvm-components: x86
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
//@ [aarch64] needs-llvm-components: aarch64
diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs
index 4a72a7f44fa0..b963aee35590 100644
--- a/tests/assembly/x86_64-floating-point-clamp.rs
+++ b/tests/assembly/x86_64-floating-point-clamp.rs
@@ -2,7 +2,7 @@
// so check to make sure that's what it's actually emitting.
//@ assembly-output: emit-asm
-//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
+//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64
//@ only-x86_64
//@ ignore-sgx
diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen/target-feature-inline-closure.rs
index 88bd413a8707..20bb4e66ff21 100644
--- a/tests/codegen/target-feature-inline-closure.rs
+++ b/tests/codegen/target-feature-inline-closure.rs
@@ -1,5 +1,5 @@
//@ only-x86_64
-//@ compile-flags: -Copt-level=3
+//@ compile-flags: -Copt-level=3 -Ctarget-cpu=x86-64
#![crate_type = "lib"]
#![feature(target_feature_11)]
diff --git a/tests/ui/asm/x86_64/target-feature-attr.rs b/tests/ui/asm/x86_64/target-feature-attr.rs
index 820be132ef79..51829be15065 100644
--- a/tests/ui/asm/x86_64/target-feature-attr.rs
+++ b/tests/ui/asm/x86_64/target-feature-attr.rs
@@ -1,4 +1,5 @@
//@ only-x86_64
+//@ compile-flags: -C target-cpu=x86-64
#![feature(avx512_target_feature)]
diff --git a/tests/ui/asm/x86_64/target-feature-attr.stderr b/tests/ui/asm/x86_64/target-feature-attr.stderr
index c852726ee7ff..1a9962732cfb 100644
--- a/tests/ui/asm/x86_64/target-feature-attr.stderr
+++ b/tests/ui/asm/x86_64/target-feature-attr.stderr
@@ -1,23 +1,23 @@
error: register class `ymm_reg` requires the `avx` target feature
- --> $DIR/target-feature-attr.rs:18:40
+ --> $DIR/target-feature-attr.rs:19:40
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^
error: register class `ymm_reg` requires the `avx` target feature
- --> $DIR/target-feature-attr.rs:18:55
+ --> $DIR/target-feature-attr.rs:19:55
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^
error: register class `ymm_reg` requires the `avx` target feature
- --> $DIR/target-feature-attr.rs:18:70
+ --> $DIR/target-feature-attr.rs:19:70
|
LL | asm!("vaddps {2:y}, {0:y}, {1:y}", in(ymm_reg) x, in(ymm_reg) y, lateout(ymm_reg) x);
| ^^^^^^^^^^^^^^^^^^
error: register class `kreg` requires at least one of the following target features: avx512bw, avx512f
- --> $DIR/target-feature-attr.rs:33:23
+ --> $DIR/target-feature-attr.rs:34:23
|
LL | asm!("/* {0} */", in(kreg) x);
| ^^^^^^^^^^
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.rs b/tests/ui/consts/const-eval/const_fn_target_feature.rs
index b56b68a57958..d0de9d8d7a34 100644
--- a/tests/ui/consts/const-eval/const_fn_target_feature.rs
+++ b/tests/ui/consts/const-eval/const_fn_target_feature.rs
@@ -1,5 +1,5 @@
//@ only-x86_64
-//@ compile-flags:-C target-feature=+ssse3
+//@ compile-flags: -C target-cpu=x86-64 -C target-feature=+ssse3
#![crate_type = "lib"]
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
index c73b8d7e4d29..6fb0688008e6 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.rs
@@ -1,4 +1,5 @@
//@ only-x86_64
+//@ compile-flags: -C target-cpu=x86-64
#![feature(target_feature_11)]
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
index d9d7e297f8e9..fed3da6594cb 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
@@ -1,5 +1,5 @@
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:25:5
+ --> $DIR/safe-calls.rs:26:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -8,7 +8,7 @@ LL | sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:27:5
+ --> $DIR/safe-calls.rs:28:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@@ -16,7 +16,7 @@ LL | avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:29:5
+ --> $DIR/safe-calls.rs:30:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -24,7 +24,7 @@ LL | Quux.avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:35:5
+ --> $DIR/safe-calls.rs:36:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@@ -32,7 +32,7 @@ LL | avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:37:5
+ --> $DIR/safe-calls.rs:38:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -40,7 +40,7 @@ LL | Quux.avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:43:5
+ --> $DIR/safe-calls.rs:44:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -49,7 +49,7 @@ LL | sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:45:5
+ --> $DIR/safe-calls.rs:46:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@@ -57,7 +57,7 @@ LL | avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:47:5
+ --> $DIR/safe-calls.rs:48:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -65,7 +65,7 @@ LL | Quux.avx_bmi2();
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:54:5
+ --> $DIR/safe-calls.rs:55:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -74,7 +74,7 @@ LL | sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:58:15
+ --> $DIR/safe-calls.rs:59:15
|
LL | const _: () = sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -83,7 +83,7 @@ LL | const _: () = sse2();
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block
- --> $DIR/safe-calls.rs:61:15
+ --> $DIR/safe-calls.rs:62:15
|
LL | const _: () = sse2_and_fxsr();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@@ -92,7 +92,7 @@ LL | const _: () = sse2_and_fxsr();
= note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]`
error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
- --> $DIR/safe-calls.rs:68:5
+ --> $DIR/safe-calls.rs:69:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@@ -101,12 +101,12 @@ LL | sse2();
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
note: an unsafe function restricts its caller, but its body is safe by default
- --> $DIR/safe-calls.rs:67:1
+ --> $DIR/safe-calls.rs:68:1
|
LL | unsafe fn needs_unsafe_block() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
- --> $DIR/safe-calls.rs:64:8
+ --> $DIR/safe-calls.rs:65:8
|
LL | #[deny(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/sse2.rs b/tests/ui/sse2.rs
index fa6d79713b4b..c203ca2716ff 100644
--- a/tests/ui/sse2.rs
+++ b/tests/ui/sse2.rs
@@ -20,6 +20,6 @@ fn main() {
"SSE2 was not detected as available on an x86 platform");
}
// check a negative case too -- allowed on x86, but not enabled by default
- assert!(cfg!(not(target_feature = "avx2")),
- "AVX2 shouldn't be detected as available by default on any platform");
+ assert!(cfg!(not(target_feature = "avx512f")),
+ "AVX512 shouldn't be detected as available by default on any platform");
}
--
2.44.0

View file

@ -1,23 +1,21 @@
From e9405caf32dfb31bf17c3da0299df515a3755107 Mon Sep 17 00:00:00 2001
From 61b5cc96337da2121221dd1bcdb63fd36551d065 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 16 Aug 2024 10:12:58 -0700
Date: Wed, 1 Nov 2023 15:21:15 -0700
Subject: [PATCH] Use lld provided by system
---
compiler/rustc_target/src/spec/base/wasm.rs | 3 +--
.../src/spec/targets/aarch64_unknown_none_softfloat.rs | 2 +-
compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs | 1 +
compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs | 2 +-
compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs | 1 +
5 files changed, 5 insertions(+), 4 deletions(-)
compiler/rustc_target/src/spec/base/wasm.rs | 3 +--
compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs | 2 +-
compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs | 1 +
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_target/src/spec/base/wasm.rs b/compiler/rustc_target/src/spec/base/wasm.rs
index 7ede45766ea..b22362227bb 100644
index 87ade9e58cf4..2ddff95febab 100644
--- a/compiler/rustc_target/src/spec/base/wasm.rs
+++ b/compiler/rustc_target/src/spec/base/wasm.rs
@@ -81,8 +81,7 @@ macro_rules! args {
// threaded model which will legalize atomics to normal operations.
singlethread: true,
@@ -91,8 +91,7 @@ macro_rules! args {
// arguments just yet
limit_rdylib_exports: false,
- // we use the LLD shipped with the Rust toolchain by default
- linker: Some("rust-lld".into()),
@ -25,11 +23,35 @@ index 7ede45766ea..b22362227bb 100644
linker_flavor: LinkerFlavor::WasmLld(Cc::No),
pre_link_args,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
index 35a4dd72b86..a9c8fc5edb8 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
index 9aa95a35f8e5..a9172f9441b7 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
@@ -17,7 +17,7 @@ pub fn target() -> Target {
static_position_independent_executables: true,
relro_level: RelroLevel::Full,
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
features:
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"
.into(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
index 5abfb8162f70..13cb43bda1a4 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
@@ -16,6 +16,7 @@ pub fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.entry_abi = Conv::X86_64Win64;
+ base.linker = Some("lld".into());
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to
// enable these CPU features explicitly before their first use, otherwise their instructions
diff -Naur a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs 2024-03-17 12:03:00.000000000 -0700
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs 2024-03-22 10:02:17.742806274 -0700
@@ -14,7 +14,7 @@
let opts = TargetOptions {
abi: "softfloat".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
@ -38,43 +60,6 @@ index 35a4dd72b86..a9c8fc5edb8 100644
features: "+v8a,+strict-align,-neon,-fp-armv8".into(),
relocation_model: RelocModel::Static,
disable_redzone: true,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
index 327b52389b9..17313d7e8b3 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
@@ -9,6 +9,7 @@ pub(crate) fn target() -> Target {
base.max_atomic_width = Some(128);
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]);
base.features = "+v8a".into();
+ base.linker = Some("lld".into());
Target {
llvm_target: "aarch64-unknown-windows".into(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
index 1a6343595f5..8015b082cd1 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
static_position_independent_executables: true,
relro_level: RelroLevel::Full,
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
rustc_abi: Some(RustcAbi::X86Softfloat),
features: "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float".into(),
supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
index 0cf6a879462..3677fc662de 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
@@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.entry_abi = CanonAbi::X86(X86Call::Win64);
+ base.linker = Some("lld".into());
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to
// enable these CPU features explicitly before their first use, otherwise their instructions
--
2.51.0
2.41.0

View file

@ -1,34 +1,36 @@
From 8364de4cb8edab85efcb895824ce06f4a95bd26f Mon Sep 17 00:00:00 2001
From 2b99134e2884fa56bcab6d360885ec5421048e66 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 18 Aug 2025 17:11:07 -0700
Subject: [PATCH] bootstrap: allow disabling target self-contained
Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
---
bootstrap.example.toml | 5 +++++
config.example.toml | 5 +++++
src/bootstrap/src/core/build_steps/compile.rs | 4 ++++
src/bootstrap/src/core/config/config.rs | 4 ++++
src/bootstrap/src/core/config/toml/target.rs | 5 +++++
src/bootstrap/src/core/config/config.rs | 8 ++++++++
src/bootstrap/src/lib.rs | 5 +++++
5 files changed, 23 insertions(+)
4 files changed, 22 insertions(+)
diff --git a/bootstrap.example.toml b/bootstrap.example.toml
index 6f37e51a47d..ee21bc06bea 100644
--- a/bootstrap.example.toml
+++ b/bootstrap.example.toml
@@ -1077,3 +1077,8 @@
# pass `off`:
# - x86_64-unknown-linux-gnu
#default-linker-linux-override = "off" (for most targets)
+
diff --git a/config.example.toml b/config.example.toml
index f94553dd63f7..5ec969c80a37 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -869,6 +869,11 @@
# argument as the test binary.
#runner = <none> (string)
+# Copy libc and CRT objects into the target lib/self-contained/ directory.
+# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other
+# targets may ignore this setting if they have nothing to be contained.
+#self-contained = <platform-specific> (bool)
+
# =============================================================================
# Distribution options
#
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 6857a40ada8..9a98323a704 100644
index e927b491c71e..69a80d01d6b9 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -368,6 +368,10 @@ fn copy_self_contained_objects(
@@ -356,6 +356,10 @@ fn copy_self_contained_objects(
compiler: &Compiler,
target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> {
@ -36,54 +38,24 @@ index 6857a40ada8..9a98323a704 100644
+ return vec![];
+ }
+
let libdir_self_contained =
builder.sysroot_target_libdir(*compiler, target).join("self-contained");
let libdir_self_contained = builder.sysroot_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 4b7ae6df360..6bab269a33c 100644
index 3e1bc9a9acdd..5e24a9cc4f60 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -864,6 +864,7 @@ pub(crate) fn parse_inner(
runner: target_runner,
optimized_compiler_builtins: target_optimized_compiler_builtins,
jemalloc: target_jemalloc,
+ self_contained: target_self_contained
} = cfg;
let mut target = Target::from_triple(&triple);
@@ -921,6 +922,9 @@ pub(crate) fn parse_inner(
if let Some(s) = target_no_std {
target.no_std = s;
}
+ if let Some(s) = target_self_contained {
+ target.self_contained = s;
+ }
target.cc = target_cc.map(PathBuf::from);
target.cxx = target_cxx.map(PathBuf::from);
target.ar = target_ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/core/config/toml/target.rs b/src/bootstrap/src/core/config/toml/target.rs
index 4c7afa50b96..83b8a1b50ca 100644
--- a/src/bootstrap/src/core/config/toml/target.rs
+++ b/src/bootstrap/src/core/config/toml/target.rs
@@ -47,6 +47,7 @@ struct TomlTarget {
runner: Option<String> = "runner",
optimized_compiler_builtins: Option<CompilerBuiltins> = "optimized-compiler-builtins",
jemalloc: Option<bool> = "jemalloc",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -80,6 +81,7 @@ pub struct Target {
pub codegen_backends: Option<Vec<CodegenBackendKind>>,
pub optimized_compiler_builtins: Option<CompilerBuiltins>,
pub jemalloc: Option<bool>,
@@ -586,6 +586,7 @@ pub struct Target {
pub runner: Option<String>,
pub no_std: bool,
pub codegen_backends: Option<Vec<String>>,
+ pub self_contained: bool,
}
impl Target {
@@ -91,6 +93,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("emscripten") {
target.runner = Some("node".into());
@@ -594,6 +595,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true;
}
+ if triple.contains("-musl") || triple.contains("-wasi") || triple.contains("-windows-gnu") {
+ target.self_contained = true;
@ -91,11 +63,29 @@ index 4c7afa50b96..83b8a1b50ca 100644
target
}
}
@@ -1150,6 +1154,7 @@ struct TomlTarget {
no_std: Option<bool> = "no-std",
codegen_backends: Option<Vec<String>> = "codegen-backends",
runner: Option<String> = "runner",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -1870,6 +1875,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std {
target.no_std = s;
}
+ if let Some(s) = cfg.self_contained {
+ target.self_contained = s;
+ }
target.cc = cfg.cc.map(PathBuf::from);
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 dd30f05b728..cc89a84071e 100644
index 5ed6b357e20a..c23b21d65713 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1441,6 +1441,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
@@ -1348,6 +1348,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std)
}
@ -108,5 +98,5 @@ index dd30f05b728..cc89a84071e 100644
/// and `remote-test-server` binaries.
fn remote_tested(&self, target: TargetSelection) -> bool {
--
2.51.0
2.44.0

View file

@ -0,0 +1,198 @@
From e8fb8c36ca0de817b3d30f603d6d6b3c56e8b0be Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 5 Apr 2024 15:07:58 -0700
Subject: [PATCH] bootstrap: move all of rustc's flags to `rustc_cargo`
This ensures that `RUSTFLAGS` will be consistent between all modes of
building the compiler, so they won't trigger a rebuild by cargo. This
kind of fix was started in #119414 just for LTO flags, but it's
applicable to all kinds of flags that might be configured.
---
src/bootstrap/src/core/build_steps/check.rs | 2 +-
src/bootstrap/src/core/build_steps/compile.rs | 107 +++++++++---------
src/bootstrap/src/core/build_steps/doc.rs | 2 +-
src/bootstrap/src/core/build_steps/test.rs | 2 +-
4 files changed, 59 insertions(+), 54 deletions(-)
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index 55180a82885b..37d91b14ca1b 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -296,7 +296,7 @@ fn run(self, builder: &Builder<'_>) {
cargo_subcommand(builder.kind),
);
- rustc_cargo(builder, &mut cargo, target, compiler.stage);
+ rustc_cargo(builder, &mut cargo, target, &compiler);
// For ./x.py clippy, don't run with --all-targets because
// linting tests and benchmarks can produce very noisy results
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index e03997181ee5..9420e40d6c2b 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -945,55 +945,10 @@ fn run(self, builder: &Builder<'_>) -> u32 {
"build",
);
- rustc_cargo(builder, &mut cargo, target, compiler.stage);
+ rustc_cargo(builder, &mut cargo, target, &compiler);
- if builder.config.rust_profile_use.is_some()
- && builder.config.rust_profile_generate.is_some()
- {
- panic!("Cannot use and generate PGO profiles at the same time");
- }
-
- // With LLD, we can use ICF (identical code folding) to reduce the executable size
- // of librustc_driver/rustc and to improve i-cache utilization.
- //
- // -Wl,[link options] doesn't work on MSVC. However, /OPT:ICF (technically /OPT:REF,ICF)
- // is already on by default in MSVC optimized builds, which is interpreted as --icf=all:
- // https://github.com/llvm/llvm-project/blob/3329cec2f79185bafd678f310fafadba2a8c76d2/lld/COFF/Driver.cpp#L1746
- // https://github.com/rust-lang/rust/blob/f22819bcce4abaff7d1246a56eec493418f9f4ee/compiler/rustc_codegen_ssa/src/back/linker.rs#L827
- if builder.config.lld_mode.is_used() && !compiler.host.is_msvc() {
- cargo.rustflag("-Clink-args=-Wl,--icf=all");
- }
-
- let is_collecting = if let Some(path) = &builder.config.rust_profile_generate {
- if compiler.stage == 1 {
- cargo.rustflag(&format!("-Cprofile-generate={path}"));
- // Apparently necessary to avoid overflowing the counters during
- // a Cargo build profile
- cargo.rustflag("-Cllvm-args=-vp-counters-per-site=4");
- true
- } else {
- false
- }
- } else if let Some(path) = &builder.config.rust_profile_use {
- if compiler.stage == 1 {
- cargo.rustflag(&format!("-Cprofile-use={path}"));
- if builder.is_verbose() {
- cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function");
- }
- true
- } else {
- false
- }
- } else {
- false
- };
- if is_collecting {
- // Ensure paths to Rust sources are relative, not absolute.
- cargo.rustflag(&format!(
- "-Cllvm-args=-static-func-strip-dirname-prefix={}",
- builder.config.src.components().count()
- ));
- }
+ // NB: all RUSTFLAGS should be added to `rustc_cargo()` so they will be
+ // consistently applied by check/doc/test modes too.
for krate in &*self.crates {
cargo.arg("-p").arg(krate);
@@ -1044,7 +999,12 @@ fn run(self, builder: &Builder<'_>) -> u32 {
}
}
-pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelection, stage: u32) {
+pub fn rustc_cargo(
+ builder: &Builder<'_>,
+ cargo: &mut Cargo,
+ target: TargetSelection,
+ compiler: &Compiler,
+) {
cargo
.arg("--features")
.arg(builder.rustc_features(builder.kind, target))
@@ -1055,7 +1015,7 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec
// We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
// and may just be a time sink.
- if stage != 0 {
+ if compiler.stage != 0 {
match builder.config.rust_lto {
RustcLto::Thin | RustcLto::Fat => {
// Since using LTO for optimizing dylibs is currently experimental,
@@ -1081,7 +1041,52 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec
cargo.rustflag("-Clto=off");
}
- rustc_cargo_env(builder, cargo, target, stage);
+ // With LLD, we can use ICF (identical code folding) to reduce the executable size
+ // of librustc_driver/rustc and to improve i-cache utilization.
+ //
+ // -Wl,[link options] doesn't work on MSVC. However, /OPT:ICF (technically /OPT:REF,ICF)
+ // is already on by default in MSVC optimized builds, which is interpreted as --icf=all:
+ // https://github.com/llvm/llvm-project/blob/3329cec2f79185bafd678f310fafadba2a8c76d2/lld/COFF/Driver.cpp#L1746
+ // https://github.com/rust-lang/rust/blob/f22819bcce4abaff7d1246a56eec493418f9f4ee/compiler/rustc_codegen_ssa/src/back/linker.rs#L827
+ if builder.config.lld_mode.is_used() && !compiler.host.is_msvc() {
+ cargo.rustflag("-Clink-args=-Wl,--icf=all");
+ }
+
+ if builder.config.rust_profile_use.is_some() && builder.config.rust_profile_generate.is_some() {
+ panic!("Cannot use and generate PGO profiles at the same time");
+ }
+ let is_collecting = if let Some(path) = &builder.config.rust_profile_generate {
+ if compiler.stage == 1 {
+ cargo.rustflag(&format!("-Cprofile-generate={path}"));
+ // Apparently necessary to avoid overflowing the counters during
+ // a Cargo build profile
+ cargo.rustflag("-Cllvm-args=-vp-counters-per-site=4");
+ true
+ } else {
+ false
+ }
+ } else if let Some(path) = &builder.config.rust_profile_use {
+ if compiler.stage == 1 {
+ cargo.rustflag(&format!("-Cprofile-use={path}"));
+ if builder.is_verbose() {
+ cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function");
+ }
+ true
+ } else {
+ false
+ }
+ } else {
+ false
+ };
+ if is_collecting {
+ // Ensure paths to Rust sources are relative, not absolute.
+ cargo.rustflag(&format!(
+ "-Cllvm-args=-static-func-strip-dirname-prefix={}",
+ builder.config.src.components().count()
+ ));
+ }
+
+ rustc_cargo_env(builder, cargo, target, compiler.stage);
}
pub fn rustc_cargo_env(
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 51b5cdc05657..a22cbeacf016 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -804,7 +804,7 @@ fn run(self, builder: &Builder<'_>) {
// see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222
// cargo.rustdocflag("--generate-link-to-definition");
- compile::rustc_cargo(builder, &mut cargo, target, compiler.stage);
+ compile::rustc_cargo(builder, &mut cargo, target, &compiler);
cargo.arg("-Zunstable-options");
cargo.arg("-Zskip-rustdoc-fingerprint");
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index bacf5f0d33ce..5277c38a4ad0 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -2671,7 +2671,7 @@ fn run(self, builder: &Builder<'_>) {
}
}
Mode::Rustc => {
- compile::rustc_cargo(builder, &mut cargo, target, compiler.stage);
+ compile::rustc_cargo(builder, &mut cargo, target, &compiler);
}
_ => panic!("can only test libraries"),
};
--
2.44.0

View file

@ -0,0 +1,27 @@
From f25809d2d33e1141d73487e55fe155f41762aef3 Mon Sep 17 00:00:00 2001
From: onur-ozkan <work@onurozkan.dev>
Date: Sun, 10 Mar 2024 09:16:24 +0300
Subject: [PATCH] fix `long-linker-command-lines` failure caused by
`rust.rpath=false`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
---
tests/run-make/long-linker-command-lines/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/run-make/long-linker-command-lines/Makefile b/tests/run-make/long-linker-command-lines/Makefile
index f864ea74f4a9..b573038e344a 100644
--- a/tests/run-make/long-linker-command-lines/Makefile
+++ b/tests/run-make/long-linker-command-lines/Makefile
@@ -1,6 +1,8 @@
# ignore-cross-compile
include ../tools.mk
+export LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
+
all:
$(RUSTC) foo.rs -g -O
RUSTC="$(RUSTC_ORIGINAL)" $(call RUN,foo)
--
2.44.0

View file

@ -1,28 +0,0 @@
From 7d83bae4e2577ffa2afaf2fddb6948c1756a403c Mon Sep 17 00:00:00 2001
From: Paul Murphy <paumurph@redhat.com>
Date: Thu, 10 Jul 2025 09:06:22 -0500
Subject: [PATCH] only copy rustlib into stage0 sysroot
Otherwise, much more is copied, and doing so likely runs into
permissions errors if the bootstrap toolchain lives in the host's
sysroot.
---
src/bootstrap/src/core/build_steps/compile.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 4d0ae54e1ef..4ef70dd9b97 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -811,7 +811,7 @@ 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.
--
2.49.0

View file

@ -0,0 +1,183 @@
From a70f23c50b61c1a3335f2943375a04ae7abf2fa4 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 11 Apr 2024 14:58:42 -0700
Subject: [PATCH] test: don't compress test registry crates
They are still nominally gzipped, but using `Compression::none()` makes
them consistent even across zlib and zlib-ng, and this fixes checksum
differences in the testsuite. There is a one-time update of all those
checksums to catch up with this change though.
---
crates/cargo-test-support/src/registry.rs | 2 +-
tests/testsuite/alt_registry.rs | 2 +-
.../cargo_add/locked_unchanged/in/Cargo.lock | 2 +-
.../cargo_add/lockfile_updated/in/Cargo.lock | 2 +-
.../cargo_add/lockfile_updated/out/Cargo.lock | 4 ++--
.../cargo_remove/update_lock_file/in/Cargo.lock | 16 ++++++++--------
.../cargo_remove/update_lock_file/out/Cargo.lock | 12 ++++++------
7 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/crates/cargo-test-support/src/registry.rs b/crates/cargo-test-support/src/registry.rs
index e65baeab17d7..f8b4b1447822 100644
--- a/crates/cargo-test-support/src/registry.rs
+++ b/crates/cargo-test-support/src/registry.rs
@@ -1469,7 +1469,7 @@ impl Package {
let dst = self.archive_dst();
t!(fs::create_dir_all(dst.parent().unwrap()));
let f = t!(File::create(&dst));
- let mut a = Builder::new(GzEncoder::new(f, Compression::default()));
+ let mut a = Builder::new(GzEncoder::new(f, Compression::none()));
if !self
.files
diff --git a/tests/testsuite/alt_registry.rs b/tests/testsuite/alt_registry.rs
index e122199baa41..fb88105374a2 100644
--- a/tests/testsuite/alt_registry.rs
+++ b/tests/testsuite/alt_registry.rs
@@ -1493,7 +1493,7 @@ dependencies = [
name = "foo"
version = "0.1.0"
source = "sparse+http://[..]/"
-checksum = "f6a200a9339fef960979d94d5c99cbbfd899b6f5a396a55d9775089119050203""#,
+checksum = "458c1addb23fde7dfbca0410afdbcc0086f96197281ec304d9e0e10def3cb899""#,
);
}
diff --git a/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock b/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock
index 011b335926ee..b88709a9e9be 100644
--- a/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock
+++ b/tests/testsuite/cargo_add/locked_unchanged/in/Cargo.lock
@@ -13,4 +13,4 @@ dependencies = [
name = "my-package"
version = "99999.0.0+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62c45acf9e11d2f97f5b318143219c0b4102eafef1c22a4b545b47104691d915"
+checksum = "73cfa03cf28feb001362b377a837910c5a6ec1cc5cceaa562b97fc14d15edec8"
diff --git a/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock b/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock
index d9bcc988d3f2..d8fa962f3069 100644
--- a/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock
+++ b/tests/testsuite/cargo_add/lockfile_updated/in/Cargo.lock
@@ -14,4 +14,4 @@ dependencies = [
name = "unrelateed-crate"
version = "0.2.0+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "266de4849a570b5dfda5e8e082a2aff885e9d2d4965dae8f8b6c8535e1ec731f"
+checksum = "b16af1a8ba7e4331ca62d945483a3028c2afbbe06a7f2ffaa0a3538ef0a7d63e"
diff --git a/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock b/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock
index 4b5fb465f104..e423b3d1f8b7 100644
--- a/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock
+++ b/tests/testsuite/cargo_add/lockfile_updated/out/Cargo.lock
@@ -14,10 +14,10 @@ dependencies = [
name = "my-package"
version = "99999.0.0+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62c45acf9e11d2f97f5b318143219c0b4102eafef1c22a4b545b47104691d915"
+checksum = "73cfa03cf28feb001362b377a837910c5a6ec1cc5cceaa562b97fc14d15edec8"
[[package]]
name = "unrelateed-crate"
version = "0.2.0+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "266de4849a570b5dfda5e8e082a2aff885e9d2d4965dae8f8b6c8535e1ec731f"
+checksum = "b16af1a8ba7e4331ca62d945483a3028c2afbbe06a7f2ffaa0a3538ef0a7d63e"
diff --git a/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock
index 2302220f2fb7..a4018e70eb47 100644
--- a/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock
+++ b/tests/testsuite/cargo_remove/update_lock_file/in/Cargo.lock
@@ -19,40 +19,40 @@ dependencies = [
name = "clippy"
version = "0.4.1+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47ced0eda54e9ddc6063f0e1d0164493cd16c84c6b6a0329a536967c44e205f7"
+checksum = "e95568c5ce98de9c470c1d9b387466f4d5efa9687d3af7998e7c9c1da5e399fb"
[[package]]
name = "docopt"
version = "0.6.2+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b600540c4fafb27bf6e6961f0f1e6f547c9d6126ce581ab3a92f878c8e2c9a2c"
+checksum = "d4414d2705e6b42fe10772b4ab4e3260f362669e45606eb562dc4c0023e911f6"
[[package]]
name = "regex"
version = "0.1.1+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84949cb53285a6c481d0133065a7b669871acfd9e20f273f4ce1283c309775d5"
+checksum = "bc4552a1d503f3a436bb18d1efff62eb95bd97f724d06466c55ef151ea2de9e0"
[[package]]
name = "rustc-serialize"
-version = "0.4.1+my-package"
+version = "0.4.0+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31162e7d23a085553c42dee375787b451a481275473f7779c4a63bcc267a24fd"
+checksum = "48c3645ec42f69a343fbe9734a477ae59448192e779206dbcb1a9c3397563fd8"
[[package]]
name = "semver"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "106bee742e3199d9e59f4269e458dfc825c1b4648c483b1c2b7a45cd2610a308"
+checksum = "20070289360e74dcdc28f437b08dda0c0c861c2328d749bb0d6e1a428013af83"
[[package]]
name = "serde"
version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be7d269f612a60e3c2c4a4a120e2d878a3f3298a5285eda6e95453905a107d9a"
+checksum = "ba76b226746eabf28375d5ad184926bbb9cd727425c8d027ea10f6c508895c6c"
[[package]]
name = "toml"
version = "0.1.1+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0f6c7804525ce0a968ef270e55a516cf4bdcf1fea0b09d130e0aa34a66745b3"
+checksum = "a9ea5fa6eaed7d7e6d9fb4571bb9d915b577e19bf2a95321ebb70fd3d894ce49"
diff --git a/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock
index 0946cee47717..af60414ddad2 100644
--- a/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock
+++ b/tests/testsuite/cargo_remove/update_lock_file/out/Cargo.lock
@@ -18,34 +18,34 @@ dependencies = [
name = "clippy"
version = "0.4.1+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47ced0eda54e9ddc6063f0e1d0164493cd16c84c6b6a0329a536967c44e205f7"
+checksum = "e95568c5ce98de9c470c1d9b387466f4d5efa9687d3af7998e7c9c1da5e399fb"
[[package]]
name = "docopt"
version = "0.6.2+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b600540c4fafb27bf6e6961f0f1e6f547c9d6126ce581ab3a92f878c8e2c9a2c"
+checksum = "d4414d2705e6b42fe10772b4ab4e3260f362669e45606eb562dc4c0023e911f6"
[[package]]
name = "regex"
version = "0.1.1+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84949cb53285a6c481d0133065a7b669871acfd9e20f273f4ce1283c309775d5"
+checksum = "bc4552a1d503f3a436bb18d1efff62eb95bd97f724d06466c55ef151ea2de9e0"
[[package]]
name = "semver"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "106bee742e3199d9e59f4269e458dfc825c1b4648c483b1c2b7a45cd2610a308"
+checksum = "20070289360e74dcdc28f437b08dda0c0c861c2328d749bb0d6e1a428013af83"
[[package]]
name = "serde"
version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be7d269f612a60e3c2c4a4a120e2d878a3f3298a5285eda6e95453905a107d9a"
+checksum = "ba76b226746eabf28375d5ad184926bbb9cd727425c8d027ea10f6c508895c6c"
[[package]]
name = "toml"
version = "0.1.1+my-package"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0f6c7804525ce0a968ef270e55a516cf4bdcf1fea0b09d130e0aa34a66745b3"
+checksum = "a9ea5fa6eaed7d7e6d9fb4571bb9d915b577e19bf2a95321ebb70fd3d894ce49"
--
2.44.0

View file

@ -0,0 +1,63 @@
From 642e12326055268c7605b31e7f91edf8f58e54d4 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 11 Apr 2024 15:33:44 -0700
Subject: [PATCH 2/2] Use `env::split_paths`/`join_paths` in runtest
(cherry picked from commit 7e171c72cbddb0636fa8ce71a0e862486ae72625)
---
src/tools/compiletest/src/runtest.rs | 31 ++++++++++++++--------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3c775ea0651c..852ffa0a62a8 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -3767,10 +3767,13 @@ fn run_rmake_v2_test(&self) {
debug!(?support_lib_deps);
debug!(?support_lib_deps_deps);
- let mut host_dylib_env_paths = String::new();
- host_dylib_env_paths.push_str(&cwd.join(&self.config.compile_lib_path).to_string_lossy());
- host_dylib_env_paths.push(':');
- host_dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
+ let orig_dylib_env_paths =
+ Vec::from_iter(env::split_paths(&env::var(dylib_env_var()).unwrap()));
+
+ let mut host_dylib_env_paths = Vec::new();
+ host_dylib_env_paths.push(cwd.join(&self.config.compile_lib_path));
+ host_dylib_env_paths.extend(orig_dylib_env_paths.iter().cloned());
+ let host_dylib_env_paths = env::join_paths(host_dylib_env_paths).unwrap();
let res = self.cmd2procres(
Command::new(&self.config.rustc_path)
@@ -3810,19 +3813,15 @@ fn run_rmake_v2_test(&self) {
// Finally, we need to run the recipe binary to build and run the actual tests.
debug!(?recipe_bin);
- let mut dylib_env_paths = String::new();
- dylib_env_paths.push_str(&env::var(dylib_env_var()).unwrap());
- dylib_env_paths.push(':');
- dylib_env_paths.push_str(&support_lib_path.parent().unwrap().to_string_lossy());
- dylib_env_paths.push(':');
- dylib_env_paths.push_str(
- &stage_std_path.join("rustlib").join(&self.config.host).join("lib").to_string_lossy(),
- );
+ let mut dylib_env_paths = orig_dylib_env_paths.clone();
+ dylib_env_paths.push(support_lib_path.parent().unwrap().to_path_buf());
+ dylib_env_paths.push(stage_std_path.join("rustlib").join(&self.config.host).join("lib"));
+ let dylib_env_paths = env::join_paths(dylib_env_paths).unwrap();
- let mut target_rpath_env_path = String::new();
- target_rpath_env_path.push_str(&tmpdir.to_string_lossy());
- target_rpath_env_path.push(':');
- target_rpath_env_path.push_str(&dylib_env_paths);
+ let mut target_rpath_env_path = Vec::new();
+ target_rpath_env_path.push(&tmpdir);
+ target_rpath_env_path.extend(&orig_dylib_env_paths);
+ let target_rpath_env_path = env::join_paths(target_rpath_env_path).unwrap();
let mut cmd = Command::new(&recipe_bin);
cmd.current_dir(&self.testpaths.file)
--
2.44.0

View file

@ -1,20 +1,19 @@
From 862d09fe2e8b0f5ce8fe7bfc592cda66a1d74c08 Mon Sep 17 00:00:00 2001
From e3b7d2e3d3b4fcbc6591de606957c0fd59b5e547 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 18 Aug 2025 17:13:28 -0700
Date: Thu, 28 Sep 2023 18:18:16 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi
---
compiler/rustc_codegen_ssa/src/back/link.rs | 10 ++++++++++
compiler/rustc_target/src/spec/json.rs | 4 ++++
compiler/rustc_target/src/spec/mod.rs | 2 ++
.../rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++---
4 files changed, 20 insertions(+), 3 deletions(-)
compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++
compiler/rustc_target/src/spec/mod.rs | 4 ++++
compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++---
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index 48b01ea2df19..59b87396fed2 100644
index f5e8d5fc92a9..f4ad3f725427 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1559,6 +1559,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
@@ -1563,6 +1563,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path;
}
}
@ -24,54 +23,24 @@ index 48b01ea2df19..59b87396fed2 100644
+ return file_path;
+ }
+ }
for search_path in sess.target_filesearch().search_paths(PathKind::Native) {
for search_path in fs.search_paths() {
let file_path = search_path.dir.join(name);
if file_path.exists() {
@@ -2140,6 +2146,10 @@ fn add_library_search_dirs(
}
ControlFlow::<()>::Continue(())
});
+
@@ -2049,6 +2055,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path();
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
}
+ if let Some(lib_path) = &sess.target.options.external_lib_path {
+ cmd.include_path(Path::new(lib_path.as_ref()));
+ }
}
/// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs
index f236be92b3b6..eea6e0c203d2 100644
--- a/compiler/rustc_target/src/spec/json.rs
+++ b/compiler/rustc_target/src/spec/json.rs
@@ -81,6 +81,7 @@ macro_rules! forward_opt {
forward!(linker_is_gnu_json);
forward!(pre_link_objects);
forward!(post_link_objects);
+ forward_opt!(external_lib_path);
forward!(pre_link_objects_self_contained);
forward!(post_link_objects_self_contained);
@@ -301,6 +302,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);
+ target_option_val!(external_lib_path);
target_option_val!(pre_link_objects_self_contained, "pre-link-objects-fallback");
target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback");
target_option_val!(link_args - pre_link_args_json, "pre-link-args");
@@ -511,6 +513,8 @@ struct TargetSpecJson {
pre_link_objects: Option<CrtObjects>,
#[serde(rename = "post-link-objects")]
post_link_objects: Option<CrtObjects>,
+ #[serde(rename = "external-lib-path")]
+ external_lib_path: Option<StaticCow<str>>,
#[serde(rename = "pre-link-objects-fallback")]
pre_link_objects_self_contained: Option<CrtObjects>,
#[serde(rename = "post-link-objects-fallback")]
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 07fb1ce63f7c..c076c2836f84 100644
index 941d767b850d..cd0a2ce51989 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1992,6 +1992,7 @@ pub struct TargetOptions {
@@ -1881,6 +1881,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
@ -79,7 +48,7 @@ index 07fb1ce63f7c..c076c2836f84 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,
@@ -2518,6 +2519,7 @@ fn default() -> TargetOptions {
@@ -2368,6 +2369,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),
@ -87,13 +56,29 @@ index 07fb1ce63f7c..c076c2836f84 100644
pre_link_objects_self_contained: Default::default(),
post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False,
@@ -3064,6 +3066,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);
+ key!(external_lib_path, optional);
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`
@@ -3327,6 +3330,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);
+ target_option_val!(external_lib_path);
target_option_val!(pre_link_objects_self_contained, "pre-link-objects-fallback");
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 26add451ed25..3eaf050e6823 100644
index 7cbe9f09e6ca..b524890c2ec5 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -21,11 +21,12 @@ pub(crate) fn target() -> Target {
options.env = "p1".into();
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasip1"]);
@@ -20,11 +20,12 @@ pub fn target() -> Target {
options.os = "wasi".into();
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]);
- options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
- options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@ -108,5 +93,5 @@ index 26add451ed25..3eaf050e6823 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.51.0
2.44.0

View file

@ -48,7 +48,7 @@
# __cargo: cargo command with environment variables
#
# CARGO_HOME: This ensures cargo reads configuration file from .cargo/config.toml,
# CARGO_HOME: This ensures cargo reads configuration file from .cargo/config,
# and prevents writing any files to $HOME during RPM builds.
%__cargo /usr/bin/env CARGO_HOME=.cargo RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo
@ -61,7 +61,7 @@
#
# This involves four steps:
# - create the ".cargo" directory if it doesn't exist yet
# - dump custom cargo configuration into ".cargo/config.toml"
# - dump custom cargo configuration into ".cargo/config"
# - remove "Cargo.lock" if it exists (it breaks builds with custom cargo config)
# - remove "Cargo.toml.orig" if it exists (it breaks running "cargo package")
#
@ -79,7 +79,7 @@ set -euo pipefail\
/usr/bin/ln -s rpm target/release\
%{__rm} -rf .cargo/\
%{__mkdir} -p .cargo\
cat > .cargo/config.toml << EOF\
cat > .cargo/config << EOF\
[build]\
rustc = "%{__rustc}"\
rustdoc = "%{__rustdoc}"\
@ -104,7 +104,7 @@ verbose = true\
EOF\
%{-V:%{__tar} -xoaf %{S:%{-V*}}}\
%{!?-N:\
cat >> .cargo/config.toml << EOF\
cat >> .cargo/config << EOF\
[source.vendored-sources]\
directory = "%{-v*}%{-V:./vendor}"\
\

View file

@ -1,6 +1,5 @@
summary: CI Gating Plan
discover:
how: fmf
url: https://src.fedoraproject.org/tests/rust.git
execute:
how: tmt

View file

@ -6,22 +6,3 @@ debuginfo:
# https://github.com/rust-lang/rust/issues/45854
- /usr/lib/debug/usr/bin/rustc-*.i386.debug
unicode:
ignore:
# These files are known to contain forbidden unicode chars as
# they are tests for those.
- rustc-*-src/tests/ui/lint/issue-90614-accept-allow-text-direction-codepoint-in-comment-lint.rs
- rustc-*-src/tests/ui/parser/unicode-control-codepoints.rs
- rustc-*-src/tests/ui/parser/macro/unicode-control-codepoints-macros.rs
- rustc-*-src/tests/ui/parser/macro/auxiliary/unicode-control.rs
- rustc-*-src/compiler/rustc_lint/src/hidden_unicode_codepoints.rs
- rustc-*-src/compiler/rustc_lint_defs/src/builtin.rs
- rustc-*-src/vendor/idna/tests/IdnaTestV2.txt
- rustc-*-src/vendor/idna-*/tests/IdnaTestV2.txt
- rustc-*-src/vendor/mdbook*/tests/testsuite/search/reasonable_search_index/expected_index.js
- rustc-*-src/vendor/mdbook*/tests/testsuite/search/reasonable_search_index/src/first/unicode.md
- rustc-*-src/vendor/wast-*/tests/parse-fail/confusing-string?.wat
- 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

443
rust.spec
View file

@ -1,8 +1,8 @@
Name: rust
Version: 1.92.0
Version: 1.78.0
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-3.0)
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)
# ^ written as: (rust itself) and (bundled libraries)
URL: https://www.rust-lang.org
@ -11,12 +11,12 @@ URL: https://www.rust-lang.org
%global rust_arches x86_64 i686 armv7hl aarch64 ppc64le s390x riscv64
ExclusiveArch: %{rust_arches}
# To bootstrap from scratch, set the channel and date from src/stage0
# e.g. 1.89.0 wants rustc: 1.88.0-2025-06-26
# 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.91.0
%global bootstrap_channel 1.91.0
%global bootstrap_date 2025-10-30
%global bootstrap_version 1.77.0
%global bootstrap_channel 1.77.0
%global bootstrap_date 2024-03-21
# Only the specified arches will use bootstrap binaries.
# NOTE: Those binaries used to be uploaded with every new release, but that was
@ -25,10 +25,33 @@ 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} || 0%{?rhel} >= 10
%global extra_targets x86_64-unknown-none x86_64-unknown-uefi
%endif
%endif
%ifarch aarch64
%global extra_targets aarch64-unknown-none-softfloat
%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-27
#global wasi_libc_ref wasi-sdk-21
%global wasi_libc_ref 03b228e46bb02fcc5927253e1b8ad715072b1ae4
%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}
@ -42,37 +65,27 @@ ExclusiveArch: %{rust_arches}
%bcond_with llvm_static
# We can also choose to just use Rust's bundled LLVM, in case the system LLVM
# is insufficient. Rust currently requires LLVM 19.0+.
# See src/bootstrap/src/core/build_steps/llvm.rs, fn check_llvm_version
%global min_llvm_version 20.0.0
%global bundled_llvm_version 21.1.3
#global llvm_compat_version 19
# is insufficient. Rust currently requires LLVM 16.0+.
%global min_llvm_version 16.0.0
%global bundled_llvm_version 18.1.2
#global llvm_compat_version 17
%global llvm llvm%{?llvm_compat_version}
%bcond_with bundled_llvm
# Requires stable libgit2 1.9, and not the next minor soname change.
# Requires stable libgit2 1.7, and not the next minor soname change.
# This needs to be consistent with the bindings in vendor/libgit2-sys.
%global min_libgit2_version 1.9.0
%global next_libgit2_version 1.10.0~
%global bundled_libgit2_version 1.9.1
%if 0%{?fedora} >= 41
%global min_libgit2_version 1.7.2
%global next_libgit2_version 1.8.0~
%global bundled_libgit2_version 1.7.2
%if 0%{?fedora} >= 39
%bcond_with bundled_libgit2
%else
%bcond_without bundled_libgit2
%endif
# Try to use system oniguruma (only used at build time for rust-docs)
# src/tools/rustbook -> ... -> onig_sys v69.9.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.50.2
%global bundled_sqlite3_version 3.45.0
%if 0%{?rhel} && 0%{?rhel} < 10
%bcond_without bundled_sqlite3
%else
@ -113,7 +126,7 @@ ExclusiveArch: %{rust_arches}
# Detect non-stable channels from the version, like 1.74.0~beta.1
%{lua: do
local version = rpm.expand("%{version}")
local version_channel, subs = version:gsub("^.*~(%w+).*$", "%1", 1)
local version_channel, subs = string.gsub(version, "^.*~(%w+).*$", "%1", 1)
rpm.define("channel " .. (subs ~= 0 and version_channel or "stable"))
rpm.define("rustc_package rustc-" .. version_channel .. "-src")
end}
@ -138,10 +151,32 @@ 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.92.0-unbundle-sqlite.patch
Patch6: rustc-1.78.0-unbundle-sqlite.patch
# stage0 tries to copy all of /usr/lib, sometimes unsuccessfully, see #143735
Patch7: 0001-only-copy-rustlib-into-stage0-sysroot.patch
# https://github.com/rust-lang/rust/pull/123520
Patch7: 0001-bootstrap-move-all-of-rustc-s-flags-to-rustc_cargo.patch
# https://github.com/rust-lang/rust/pull/123652
Patch8: 0001-Fix-UI-tests-with-dist-vendored-dependencies.patch
# https://github.com/rust-lang/rust/pull/122270
Patch9: 0001-fix-long-linker-command-lines-failure-caused-by-rust.patch
# https://github.com/rust-lang/rust/pull/123763
Patch10: 0001-Set-the-host-library-path-in-run-make-v2.patch
Patch11: 0002-Use-env-split_paths-join_paths-in-runtest.patch
# https://github.com/rust-lang/rust/pull/124597
Patch12: 0001-Use-an-explicit-x86-64-cpu-in-tests-that-are-sensiti.patch
# https://github.com/rust-lang/cargo/pull/13744
Patch20: 0001-test-don-t-compress-test-registry-crates.patch
# https://github.com/rust-lang/cargo/pull/13789
Patch21: 0001-Fix-2-tests-for-offline-execution.patch
# https://github.com/rust-lang/rust-clippy/pull/12682
Patch30: 0001-The-multiple_unsafe_ops_per_block-test-needs-asm.patch
### RHEL-specific patches below ###
@ -152,14 +187,16 @@ 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.92.0-disable-libssh2.patch
Patch100: rustc-1.78.0-disable-libssh2.patch
# Get the Rust triple for any architecture and ABI.
%{lua: function rust_triple(arch, abi)
abi = abi or "gnu"
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
local abi = "gnu"
if arch == "armv7hl" then
arch = "armv7"
abi = abi.."eabihf"
abi = "gnueabihf"
elseif arch == "ppc64" then
arch = "powerpc64"
elseif arch == "ppc64le" then
arch = "powerpc64le"
elseif arch == "riscv64" then
@ -168,42 +205,11 @@ Patch100: rustc-1.92.0-disable-libssh2.patch
return arch.."-unknown-linux-"..abi
end}
%define rust_triple() %{lua: print(rust_triple(
rpm.expand("%{?1}%{!?1:%{_target_cpu}}"),
rpm.expand("%{?2}%{!?2:gnu}")
))}
%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
# 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(rpm.expand(" %{all_targets} "):find(rpm.expand(" %1 "), 1, true) or 0)
# Get the environment form of the Rust triple
%global rust_triple_env %{lua:
print(string.upper(string.gsub(rpm.expand("%{rust_triple}"), "-", "_")))
}
%if %defined bootstrap_arches
@ -211,7 +217,7 @@ end}
# Also define bootstrap_source just for the current target.
%{lua: do
local bootstrap_arches = {}
for arch in rpm.expand("%{bootstrap_arches}"):gmatch("%S+") do
for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
table.insert(bootstrap_arches, arch)
end
local base = rpm.expand("https://static.rust-lang.org/dist/%{bootstrap_date}")
@ -237,7 +243,7 @@ end}
%global local_rust_root %{_builddir}/rust-%{bootstrap_suffix}
Provides: bundled(%{name}-bootstrap) = %{bootstrap_version}
%else
BuildRequires: (cargo >= %{bootstrap_version} with cargo <= %{version})
BuildRequires: cargo >= %{bootstrap_version}
BuildRequires: (%{name} >= %{bootstrap_version} with %{name} <= %{version})
%global local_rust_root %{_prefix}
%endif
@ -257,10 +263,6 @@ 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
@ -284,7 +286,6 @@ Provides: bundled(llvm) = %{bundled_llvm_version}
BuildRequires: cmake >= 3.5.1
%if %defined llvm_compat_version
%global llvm_root %{_libdir}/%{llvm}
%global llvm_path %{llvm_root}/bin
%else
%global llvm_root %{_prefix}
%endif
@ -292,7 +293,6 @@ BuildRequires: %{llvm}-devel >= %{min_llvm_version}
%if %with llvm_static
BuildRequires: %{llvm}-static
BuildRequires: libffi-devel
BuildRequires: libxml2-devel
%endif
%endif
@ -301,10 +301,6 @@ BuildRequires: procps-ng
# debuginfo-gdb tests need gdb
BuildRequires: gdb
# Work around https://bugzilla.redhat.com/show_bug.cgi?id=2275274:
# gdb currently prints a "Unable to load 'rpm' module. Please install the python3-rpm package."
# message that breaks version detection.
BuildRequires: python3-rpm
# For src/test/run-make/static-pie
BuildRequires: glibc-static
@ -316,7 +312,7 @@ Provides: rustc%{?_isa} = %{version}-%{release}
# Always require our exact standard library
Requires: %{name}-std-static%{?_isa} = %{version}-%{release}
# The C compiler is needed at runtime just for linking. Someday rustc might
# The C compiler is needed at runtime just for linking. Someday rustc might
# invoke the linker directly, and then we'll only need binutils.
# https://github.com/rust-lang/rust/issues/11937
Requires: /usr/bin/cc
@ -341,7 +337,12 @@ Requires: /usr/bin/cc
# - wasm targets lost the archive index, which we were repairing with llvm-ranlib
# - uefi targets couldn't link builtins like memcpy, possibly due to lost COMDAT flags
%global __brp_strip_static_archive %{nil}
%global __brp_strip_lto %{nil}
%if %{without bundled_llvm}
%if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1}
%global llvm_has_filecheck 1
%endif
%endif
# We're going to override --libdir when configuring to get rustlib into a
# common path, but we'll fix the shared libraries during install.
@ -361,11 +362,11 @@ BuildRequires: mingw64-winpthreads-static
%if %defined wasm_targets
%if %with bundled_wasi_libc
BuildRequires: clang%{?llvm_compat_version}
BuildRequires: clang
%else
BuildRequires: wasi-libc-static
%endif
BuildRequires: lld%{?llvm_compat_version}
BuildRequires: lld
%endif
# For profiler_builtins
@ -375,32 +376,6 @@ BuildRequires: compiler-rt%{?llvm_compat_version}
# https://github.com/rust-lang/rust/pull/101841
Obsoletes: %{name}-analysis < 1.69.0~
# Experimenting with a fine-grained version of %%cargo_vendor_manifest,
# so we can have different bundled provides for each tool subpackage.
%define cargo_tree_manifest(n:m:f:t:) ( \
%{!-n:%{error:must specify a tool name}} \
set -euo pipefail \
mkdir -p build/manifests/%{-n*} \
%{shrink: \
env RUSTC_BOOTSTRAP=1 \
RUSTC=%{local_rust_root}/bin/rustc \
%{local_rust_root}/bin/cargo tree \
--offline --edges normal,build \
--prefix none --format "{p}" \
%{-m:--manifest-path %{-m*}/Cargo.toml} \
%{-f:--features %{-f*}} \
%{-t:--target %{-t*}} \
%* \
| sed '/([*/]/d; s/ (proc-macro)$//' \
| sort -u \
>build/manifests/%{-n*}/cargo-vendor.txt \
} \
)
%ifnarch %{bootstrap_arches}
%{?fedora:BuildRequires: cargo-rpm-macros}
%{?rhel:BuildRequires: rust-toolset}
%endif
%description
Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety.
@ -457,6 +432,18 @@ 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
@ -466,8 +453,6 @@ 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
@ -477,12 +462,6 @@ Requires: lld
%target_description x86_64-unknown-none embedded
%endif
%if %target_enabled aarch64-unknown-uefi
%target_package aarch64-unknown-uefi
Requires: lld
%target_description aarch64-unknown-uefi embedded
%endif
%if %target_enabled x86_64-unknown-uefi
%target_package x86_64-unknown-uefi
Requires: lld
@ -509,8 +488,6 @@ Summary: GDB pretty printers for Rust
BuildArch: noarch
Requires: gdb
Requires: %{name}-debugger-common = %{version}-%{release}
# rust-gdb uses rustc to find the sysroot
Requires: %{name} = %{version}-%{release}
%description gdb
This package includes the rust-gdb script, which allows easier debugging of Rust
@ -523,8 +500,6 @@ BuildArch: noarch
Requires: lldb
Requires: python3-lldb
Requires: %{name}-debugger-common = %{version}-%{release}
# rust-lldb uses rustc to find the sysroot
Requires: %{name} = %{version}-%{release}
%description lldb
This package includes the rust-lldb script, which allows easier debugging of Rust
@ -559,11 +534,10 @@ Provides: bundled(sqlite) = %{bundled_sqlite3_version}
%endif
# For tests:
BuildRequires: git-core
# Cargo is not much use without Rust, and it's worth keeping the versions
# in sync since some feature development depends on them together.
Requires: %{name} = %{version}-%{release}
# Cargo is not much use without Rust
Requires: %{name}
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
Obsoletes: cargo-vendor <= 0.1.23
Provides: cargo-vendor = %{version}-%{release}
@ -591,9 +565,6 @@ A tool for formatting Rust code according to style guidelines.
%package analyzer
Summary: Rust implementation of the Language Server Protocol
# /usr/bin/rust-analyzer is dynamically linked against internal rustc libs
Requires: %{name}%{?_isa} = %{version}-%{release}
# The standard library sources are needed for most functionality.
Recommends: %{name}-src
@ -629,7 +600,7 @@ BuildArch: noarch
Recommends: %{name}-std-static = %{version}-%{release}
%description src
This package includes source files for the Rust standard library. It may be
This package includes source files for the Rust standard library. It may be
useful as a reference for code completion tools in various editors.
@ -652,8 +623,6 @@ Summary: Rust Toolset
BuildArch: noarch
Requires: rust = %{version}-%{release}
Requires: cargo = %{version}-%{release}
Requires: rust-toolset-srpm-macros = %{version}-%{release}
Conflicts: cargo-rpm-macros
%description toolset
This is the metapackage for Rust Toolset, bringing in the Rust compiler,
@ -694,6 +663,16 @@ rm -rf %{wasi_libc_dir}/dlmalloc/
%patch -P6 -p1
%endif
%patch -P7 -p1
%patch -P8 -p1
%patch -P9 -p1
%patch -P10 -p1
%patch -P11 -p1
%patch -P12 -p1
%patch -P20 -p1 -d src/tools/cargo
%patch -P21 -p1 -d src/tools/cargo
%patch -P30 -p1 -d src/tools/clippy
%if %with disabled_libssh2
%patch -P100 -p1
@ -710,10 +689,6 @@ 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/collector/*-benchmarks/
# Remove other unused vendored libraries. This leaves the directory in place,
# because some build scripts watch them, e.g. "cargo:rerun-if-changed=curl".
@ -732,10 +707,6 @@ rm -rf src/tools/rustc-perf/collector/*-benchmarks/
%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
@ -750,12 +721,12 @@ sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/src/core/build_steps/tool.rs
%if %{without bundled_llvm} && %{with llvm_static}
# Static linking to distro LLVM needs to add -lffi
# https://github.com/rust-lang/rust/issues/34486
sed -i.ffi -e '$a #[link(name = "ffi")] extern "C" {}' \
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
compiler/rustc_llvm/src/lib.rs
%endif
# The configure macro will modify some autoconf-related files, which upsets
# cargo when it tries to verify checksums in those files. If we just truncate
# cargo when it tries to verify checksums in those files. If we just truncate
# that file list, cargo won't have anything to complain about.
find vendor -name .cargo-checksum.json \
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
@ -788,10 +759,8 @@ end}
%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}
%{?llvm_path:PATH="%{llvm_path}:$PATH"}
}
%global export_rust_env export %{rust_env}
@ -799,23 +768,12 @@ end}
%{export_rust_env}
# Some builders have relatively little memory for their CPU count.
# At least 4GB per CPU is a good rule of thumb for building rustc.
%if %undefined constrain_build
%define constrain_build(m:) %{lua:
for l in io.lines('/proc/meminfo') do
if l:sub(1, 9) == "MemTotal:" then
local opt_m = math.tointeger(rpm.expand("%{-m*}"))
local mem_total = math.tointeger(string.match(l, "MemTotal:%s+(%d+)"))
local cpu_limit = math.max(1, mem_total // (opt_m * 1024))
if cpu_limit < math.tointeger(rpm.expand("%_smp_build_ncpus")) then
rpm.define("_smp_build_ncpus " .. cpu_limit)
end
break
end
end
}
%endif
%constrain_build -m 4096
# At least 2GB per CPU is a good rule of thumb for building rustc.
ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN)
max_cpus=$(( ($(free -g | awk '/^Mem:/{print $2}') + 1) / 2 ))
if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then
ncpus="$max_cpus"
fi
%if %defined mingw_targets
%define mingw_target_config %{shrink:
@ -834,32 +792,34 @@ 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-wasip1
%make_build --quiet -C %{wasi_libc_dir} MALLOC_IMPL=emmalloc CC=clang AR=llvm-ar NM=llvm-nm
%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
}
%endif
%endif
# Find the compiler-rt library for the Rust profiler_builtins and optimized-builtins crates.
%define clang_lib %{expand:%%clang%{?llvm_compat_version}_resource_dir}/lib
%define profiler %{clang_lib}/%{_arch}-redhat-linux-gnu/libclang_rt.profile.a
test -r "%{profiler}"
# llvm < 21 does not provide a builtins library for s390x.
%if "%{_arch}" != "s390x" || 0%{?clang_major_version} >= 21
%define optimized_builtins %{clang_lib}/%{_arch}-redhat-linux-gnu/libclang_rt.builtins.a
test -r "%{optimized_builtins}"
# Find the compiler-rt library for the Rust profiler_builtins crate.
%if %defined llvm_compat_version
# 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
%define optimized_builtins false
%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}"
%configure --disable-option-checking \
--docdir=%{_pkgdocdir} \
@ -871,30 +831,25 @@ test -r "%{optimized_builtins}"
--set target.%{rust_triple}.ar=%{__ar} \
--set target.%{rust_triple}.ranlib=%{__ranlib} \
--set target.%{rust_triple}.profiler="%{profiler}" \
--set target.%{rust_triple}.optimized-compiler-builtins="%{optimized_builtins}" \
%{?mingw_target_config} \
%{?wasm_target_config} \
--python=%{__python3} \
--local-rust-root=%{local_rust_root} \
--set build.rustfmt=/bin/true \
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
%{!?llvm_has_filecheck: --disable-codegen-tests} \
%{!?with_llvm_static: --enable-llvm-link-shared } } \
--disable-llvm-static-stdcpp \
--disable-llvm-bitcode-linker \
--disable-lld \
--disable-rpath \
%{enable_debuginfo} \
%{enable_rust_opts} \
--set build.jobs=%_smp_build_ncpus \
--set build.build-stage=2 \
--set build.doc-stage=2 \
--set build.install-stage=2 \
--set build.test-stage=2 \
--set build.optimized-compiler-builtins=false \
--set rust.llvm-tools=false \
--set rust.verify-llvm-ir=true \
--enable-extended \
--tools=cargo,clippy,rust-analyzer,rustdoc,rustfmt,src \
--tools=cargo,clippy,rls,rust-analyzer,rustfmt,src \
--enable-vendor \
--enable-verbose-tests \
--release-channel=%{channel} \
@ -902,28 +857,24 @@ test -r "%{optimized_builtins}"
%global __x %{__python3} ./x.py
%if %{with rustc_pgo}
%if %with rustc_pgo
# Build the compiler with profile instrumentation
%define profraw $PWD/build/profiles
%define profdata $PWD/build/rustc.profdata
mkdir -p "%{profraw}"
%{__x} build sysroot --rust-profile-generate="%{profraw}"
%{__x} build -j "$ncpus" sysroot --rust-profile-generate="%{profraw}"
# Build cargo as a workload to generate compiler profiles
# We normally use `x.py`, but in this case we invoke the stage 2 compiler and libs
# directly to ensure we use the instrumented compiler.
env LLVM_PROFILE_FILE="%{profraw}/default_%%m_%%p.profraw" \
LD_LIBRARY_PATH=$PWD/build/host/stage2/lib \
RUSTC=$PWD/build/host/stage2/bin/rustc \
cargo build --manifest-path=src/tools/cargo/Cargo.toml
%{__x} --keep-stage=0 --keep-stage=1 build cargo
# Finalize the profile data and clean up the raw files
llvm-profdata merge -o "%{profdata}" "%{profraw}"
%{llvm_root}/bin/llvm-profdata merge -o "%{profdata}" "%{profraw}"
rm -r "%{profraw}" build/%{rust_triple}/stage2*/
# Redefine the macro to use that profile data from now on
%global __x %{__x} --rust-profile-use="%{profdata}"
%endif
# Build the compiler normally (with or without PGO)
%{__x} build sysroot
%{__x} build -j "$ncpus" sysroot
# Build everything else normally
%{__x} build
@ -933,21 +884,6 @@ for triple in %{?all_targets} ; do
%{__x} build --target=$triple std
done
# Collect cargo-vendor.txt for each tool and std
%{cargo_tree_manifest -n rustc -- -p rustc-main -p rustdoc}
%{cargo_tree_manifest -n cargo -m src/tools/cargo}
%{cargo_tree_manifest -n clippy -m src/tools/clippy}
%{cargo_tree_manifest -n rust-analyzer -m src/tools/rust-analyzer}
%{cargo_tree_manifest -n rustfmt -m src/tools/rustfmt}
%{cargo_tree_manifest -n std -m library -f backtrace}
for triple in %{?all_targets} ; do
case $triple in
*-none*) %{cargo_tree_manifest -n std-$triple -m library/alloc -t $triple} ;;
*) %{cargo_tree_manifest -n std-$triple -m library -f backtrace -t $triple} ;;
esac
done
%install
%if 0%{?rhel} && 0%{?rhel} <= 9
%{?set_build_flags}
@ -960,13 +896,16 @@ for triple in %{?all_targets} ; do
DESTDIR=%{buildroot} %{__x} install --target=$triple std
done
# The rls stub doesn't have an install target, but we can just copy it.
%{__install} -t %{buildroot}%{_bindir} build/%{rust_triple}/stage2-tools-bin/rls
# These are transient files used by x.py dist and install
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 compiler's shared libraries are in the proper libdir
# Make sure the 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' \
@ -977,12 +916,18 @@ 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 '{}' '+'
# The libdir libraries are identical to those under rustlib/. It's easier on
# library loading if we keep them in libdir, but we do need them in rustlib/
# to support dynamic linking for compiler plugins, so we'll symlink.
find %{buildroot}%{rustlibdir}/%{rust_triple}/lib/ -maxdepth 1 -type f -name '*.so' |
while read lib; do
lib2="%{buildroot}%{_libdir}/${lib##*/}"
if [ -f "$lib2" ]; then
# make sure they're actually identical!
cmp "$lib" "$lib2"
ln -v -f -r -s -T "$lib2" "$lib"
fi
done
# Remove installer artifacts (manifests, uninstall scripts, etc.)
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
@ -1056,37 +1001,14 @@ rm -rf "$TMP_HELLO"
# The results are not stable on koji, so mask errors and just log it.
# Some of the larger test artifacts are manually cleaned to save space.
# - Bootstrap is excluded because it's not something we ship, and a lot of its
# tests are geared toward the upstream CI environment.
# - Crashes are excluded because they are less reliable, especially stuff like
# SIGSEGV across different arches -- UB can do all kinds of weird things.
# They're only meant to notice "accidental" fixes anyway, not *should* crash.
%{__x} test --no-fail-fast --skip={src/bootstrap,tests/crashes} || :
# Bootstrap is excluded because it's not something we ship, and a lot of its
# tests are geared toward the upstream CI environment.
%{__x} test --no-fail-fast --skip src/bootstrap || :
rm -rf "./build/%{rust_triple}/test/"
# Cargo tests skip list
# Every test skipped here must have a documented reason to be skipped.
# Duplicates are safe to add.
# This test relies on the DNS to fail to resolve the host. DNS is not enabled
# in mock in koji so the DNS resolution doesn't take place to begin with.
# We test this after packaging
%global cargo_test_skip_list net_err_suggests_fetch_with_cli
%ifarch aarch64
# https://github.com/rust-lang/rust/issues/123733
%global cargo_test_skip_list %{cargo_test_skip_list} panic_abort_doc_tests
%endif
%if %with disabled_libssh2
# These tests need ssh - guaranteed to fail when libssh2 is disabled.
%global cargo_test_skip_list %{shrink:
%{cargo_test_skip_list}
net_err_suggests_fetch_with_cli
ssh_something_happens
}
%endif
%if "%{cargo_test_skip_list}" != ""
%define cargo_test_skip --test-args "%(printf -- '--skip %%s ' %{cargo_test_skip_list})"
%define cargo_test_skip --test-args "--skip panic_abort_doc_tests"
%endif
%{__x} test --no-fail-fast cargo %{?cargo_test_skip} || :
rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
@ -1097,6 +1019,7 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{__x} test --no-fail-fast rustfmt || :
%ldconfig_scriptlets
@ -1105,14 +1028,14 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%doc README.md
%{_bindir}/rustc
%{_bindir}/rustdoc
%{_libdir}/librustc_driver-*.so
%{_libdir}/*.so
%{_libexecdir}/rust-analyzer-proc-macro-srv
%{_mandir}/man1/rustc.1*
%{_mandir}/man1/rustdoc.1*
%license build/manifests/rustc/cargo-vendor.txt
%license %{_pkgdocdir}/COPYRIGHT.html
%license %{_pkgdocdir}/licenses/
%exclude %{_sysconfdir}/target-spec-json-schema.json
%dir %{rustlibdir}
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.so
%files std-static
@ -1120,17 +1043,13 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.rlib
%{rustlibdir}/%{rust_triple}/lib/*.so
%license build/manifests/std/cargo-vendor.txt
%license %{_pkgdocdir}/COPYRIGHT-library.html
%global target_files() \
%files std-static-%1 \
%dir %{rustlibdir} \
%dir %{rustlibdir}/%1 \
%dir %{rustlibdir}/%1/lib \
%{rustlibdir}/%1/lib/*.rlib \
%license build/manifests/std-%1/cargo-vendor.txt
%{rustlibdir}/%1/lib/*.rlib
%if %target_enabled i686-pc-windows-gnu
%target_files i686-pc-windows-gnu
@ -1150,6 +1069,15 @@ 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
@ -1163,10 +1091,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%target_files x86_64-unknown-none
%endif
%if %target_enabled aarch64-unknown-uefi
%target_files aarch64-unknown-uefi
%endif
%if %target_enabled x86_64-unknown-uefi
%target_files x86_64-unknown-uefi
%endif
@ -1212,7 +1136,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{_datadir}/zsh/site-functions/_cargo
%dir %{_datadir}/cargo
%dir %{_datadir}/cargo/registry
%license build/manifests/cargo/cargo-vendor.txt
%files -n rustfmt
@ -1220,14 +1143,13 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{_bindir}/cargo-fmt
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
%license src/tools/rustfmt/LICENSE-{APACHE,MIT}
%license build/manifests/rustfmt/cargo-vendor.txt
%files analyzer
%{_bindir}/rls
%{_bindir}/rust-analyzer
%doc src/tools/rust-analyzer/README.md
%license src/tools/rust-analyzer/LICENSE-{APACHE,MIT}
%license build/manifests/rust-analyzer/cargo-vendor.txt
%files -n clippy
@ -1235,7 +1157,6 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/"
%{_bindir}/clippy-driver
%doc src/tools/clippy/{README.md,CHANGELOG.md}
%license src/tools/clippy/LICENSE-{APACHE,MIT}
%license build/manifests/clippy/cargo-vendor.txt
%files src

View file

@ -0,0 +1,44 @@
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-04-04 15:01:24.003038403 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-04-04 15:01:24.005038377 -0700
@@ -2111,7 +2111,6 @@ checksum = "ee4126d8b4ee5c9d9ea891dd875c
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2152,20 +2151,6 @@ dependencies = [
"pkg-config",
"vcpkg",
]
-
-[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
[[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-04-04 15:01:24.005038377 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-04-04 15:02:15.816367069 -0700
@@ -44,7 +44,7 @@ curl = "0.4.46"
curl-sys = "0.4.72"
filetime = "0.2.23"
flate2 = { version = "1.0.28", default-features = false, features = ["zlib"] }
-git2 = "0.18.2"
+git2 = { version = "0.18.2", default-features = false, features = ["https"] }
git2-curl = "0.19.0"
gix = { version = "0.58.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] }
gix-features-for-configuration-only = { version = "0.38.0", package = "gix-features", features = [ "parallel" ] }

View file

@ -0,0 +1,23 @@
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-04-04 14:54:45.433205012 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-04-04 14:55:51.949342725 -0700
@@ -2149,7 +2149,6 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f"
dependencies = [
- "cc",
"pkg-config",
"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-04-04 14:54:45.433205012 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-04-04 14:55:35.823551771 -0700
@@ -77,7 +77,7 @@ proptest = "1.4.0"
pulldown-cmark = { version = "0.10.0", default-features = false, features = ["html"] }
rand = "0.8.5"
regex = "1.10.3"
-rusqlite = { version = "0.31.0", features = ["bundled"] }
+rusqlite = { version = "0.31.0", features = [] }
rustfix = { version = "0.8.2", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.9.2"

View file

@ -1,44 +0,0 @@
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 2025-08-16 15:47:14.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2025-08-18 17:31:39.554771554 -0700
@@ -2800,7 +2800,6 @@ checksum = "1c42fe03df2bd3c53a3a9c7317ad
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2847,20 +2846,6 @@ dependencies = [
"pkg-config",
"vcpkg",
]
-
-[[package]]
-name = "libssh2-sys"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
[[package]]
name = "libz-rs-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 2025-08-16 15:47:14.000000000 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2025-08-18 17:33:02.401743230 -0700
@@ -46,7 +46,7 @@ curl = "0.4.48"
curl-sys = "0.4.83"
filetime = "0.2.26"
flate2 = { version = "1.1.2", default-features = false, features = ["zlib-rs"] }
-git2 = "0.20.2"
+git2 = { version = "0.20.2", default-features = false, features = ["https"] }
git2-curl = "0.21.0"
# When updating this, also see if `gix-transport` further down needs updating or some auth-related tests will fail.
gix = { version = "0.73.0", default-features = false, features = ["progress-tree", "parallel", "dirwalk", "status"] }

View file

@ -1,23 +0,0 @@
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 2025-11-07 13:31:19.003737886 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2025-11-07 13:14:41.637982893 +0100
@@ -2835,7 +2835,6 @@ version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f"
dependencies = [
- "cc",
"pkg-config",
"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 2025-11-07 13:31:28.338643618 +0100
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2025-11-07 13:15:00.266505214 +0100
@@ -81,7 +81,7 @@ proptest = "1.8.0"
pulldown-cmark = { version = "0.13.0", default-features = false, features = ["html"] }
rand = "0.9.2"
regex = "1.11.3"
-rusqlite = { version = "0.37.0", features = ["bundled"] }
+rusqlite = { version = "0.37.0", features = [] }
rustc-hash = "2.1.1"
rustc-stable-hash = "0.1.2"
rustfix = { version = "0.9.2", path = "crates/rustfix" }

View file

@ -1,2 +1,2 @@
SHA512 (rustc-1.92.0-src.tar.xz) = a2c0b127933595b9bc2063d7b7c88d9af512c4664b18f29d44c9a6e2c68d194b87a3071717e8f1b7c858ae940baca888e10be95cd31e0201916d0bfc312a3b15
SHA512 (wasi-libc-wasi-sdk-27.tar.gz) = dfc2c36fabf32f465fc833ed0b10efffc9a35c68162ecc3e8d656d1d684d170b734d55e790614d12d925d17f49d60f0d2d01c46cecac941cf62d68eda84df13e
SHA512 (rustc-1.78.0-src.tar.xz) = d2fb9881e28849d871fda71b1b51652be3839b3283f0d32163f258c5c707a9fb7b589da8dc03bca2fefee1abdd2b44a5f17e85d8c6df7bea119d1e8d22371941
SHA512 (wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz) = 56306817a6d683aeaf61c3376700804f143b9be101729693c1c88666ea201f02a3e7a3b32150f688a784ac4aae30e46bdbe3fc79a1a9c62e7b460d11ad509045

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/rust/Sanity/basic-smoke
# Description: basic-smoke
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/rust/Sanity/basic-smoke
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: basic-smoke" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: rust" >> $(METADATA)
@echo "Requires: rust" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /tools/rust/Sanity/basic-smoke
Description: basic-smoke
Author: Martin Cermak <mcermak@redhat.com>

View file

@ -0,0 +1,13 @@
summary: basic-smoke
description: ''
contact:
- Jesus Checa Hidalgo <jcheca@redhat.com>
component:
- rust
test: ./runtest.sh
framework: beakerlib
recommend:
- rust
duration: 10m
extra-summary: /tools/rust/Sanity/basic-smoke
extra-task: /tools/rust/Sanity/basic-smoke

View file

@ -0,0 +1,55 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/rust/Sanity/basic-smoke
# Description: basic-smoke
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="$(rpm -qf $(which rustc))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
HELLO_SRC=$( mktemp )
HELLO_BIN=$( mktemp )
echo 'fn main() { println!("hello"); }' > $HELLO_SRC
rlRun "which rustc"
rlRun "rustc -V"
rlRun "rustc -o $HELLO_BIN $HELLO_SRC"
rlRun "$HELLO_BIN"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,11 @@
summary+: ": librsvg2"
require+:
- librsvg2
environment+:
PKG_TO_BUILD: "librsvg2"
duration: 20m
adjust+:
# building librsvg2 in Fedora is very flaky. Do not run it there
- when: distro == fedora
enabled: false

View file

@ -0,0 +1,13 @@
summary: rpmbuild package with rust
description: 'Ensure that rust does not break rpmbuild'
contact:
- Jesus Checa Hidalgo <jcheca@redhat.com>
component:
- rust
test: ./runtest.sh
framework: beakerlib
require+:
- rust
- rpm-build
- yum-utils
duration: 1h

View file

@ -0,0 +1,11 @@
summary+: ": ripgrep"
require+:
- ripgrep
environment+:
PKG_TO_BUILD: "ripgrep"
duration: 15m
adjust+:
# ripgrep is not part of RHEL
- when: distro != fedora
enabled: false

View file

@ -0,0 +1,11 @@
summary+: ": rpm-sequoia"
require+:
- rpm-sequoia
environment+:
PKG_TO_BUILD: "rpm-sequoia"
duration: 20m
adjust+:
- when: distro < rhel-10, centos-stream-10
enabled: false
because: "rpm-sequoia is available only in RHEL >= 10"

View file

@ -0,0 +1,55 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="$(rpm -qf $(which rustc))"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE || rlDie "rustc not found. Aborting testcase..."
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
if [[ "x" == "x${PKG_TO_BUILD}" ]]; then
rlLogError "No package was configured to build."
rlDie "The package must be passed over PKG_TO_BUILD environment variable."
fi
rlPhaseEnd
rlPhaseStart FAIL ${PKG_TO_BUILD}FetchSrcAndInstallBuildDeps
if ! rlCheckRpm $PKG_TO_BUILD; then
rlRun "yum install -y $PKG_TO_BUILD ${YUM_SWITCHES}"
rlAssertRpm $PKG_TO_BUILD
fi
rlFetchSrcForInstalled $PKG_TO_BUILD
rlRun SRPM=$(ls -1 *.src.rpm)
rlRun "rpm -ivh $SRPM"
rlRun SPECDIR="$(rpm -E '%{_specdir}')"
# Note about the spec file name: When packaging rust crates, the package
# is named rust-<crate>, as well as the spec file, but the rpm package
# (the one we use in dnf to install and query) is named as the crate,
# (without the "rust-" prefix). We have to take that into account to
# find the spec:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_package_naming
rlRun "SPECNAME=$(rpm -ql $SRPM | grep .spec)"
# Packages built with rust usually contains dynamic dependencies.
# builddep needs to be run from the srpm, not the spec file, to be able
# to generate them:
# https://fedoraproject.org/wiki/Changes/DynamicBuildRequires#rpmbuild
rlRun "yum-builddep -y ${SRPM} ${YUM_SWITCHES}"
rlPhaseEnd
rlPhaseStartTest
set -o pipefail
rlRun "rpmbuild -bb ${SPECDIR}/${SPECNAME} |& tee ${SRPM}_rpmbuild.log"
rlFileSubmit "${SRPM}_rpmbuild.log"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,6 @@
summary+: ": stratisd"
require+:
- stratisd
environment+:
PKG_TO_BUILD: "stratisd"
duration: 1h

View file

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/rust/Sanity/rust-wasm-smoke-test
# Description: Test that the rust wasm target is enabled and can compile correctly
# Author: Jesus Checa <jcheca@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/rust/Sanity/rust-wasm-smoke-test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE lib.rs test.js
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Jesus Checa <jcheca@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test that the rust wasm target is enabled and can compile correctly" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: rust" >> $(METADATA)
@echo "Requires: rust rust-std-static-wasm32-unknown-unknown nodejs" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL7" >> $(METADATA)
@echo "Architectures: aarch64 ppc64le x86_64" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /tools/rust/Sanity/rust-wasm-smoke-test
Description: Test that the rust wasm target is enabled and can compile correctly
Author: Jesus Checa <jcheca@redhat.com>

View file

@ -0,0 +1,12 @@
#[no_mangle]
pub fn fib(index: u32) -> u32 {
let mut nminus2;
let mut nminus1 = 1;
let mut n = 0;
for _ in 0..index {
nminus2 = nminus1;
nminus1 = n;
n = nminus2 + nminus1;
}
n
}

View file

@ -0,0 +1,15 @@
summary: Test that the rust wasm target is enabled and can compile correctly
description: ''
contact:
- Jesus Checa <jcheca@redhat.com>
component:
- rust
test: ./runtest.sh
framework: beakerlib
recommend:
- rust
- rust-std-static-wasm32-unknown-unknown
- nodejs
duration: 5m
extra-summary: /tools/rust/Sanity/rust-wasm-smoke-test
extra-task: /tools/rust/Sanity/rust-wasm-smoke-test

View file

@ -0,0 +1,53 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/rust/Sanity/rust-wasm-smoke-test
# Description: Test that the rust wasm target is enabled and can compile correctly
# Author: Jesus Checa <jcheca@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2021 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="$(rpm -qf $(which rustc)) rust-std-static-wasm32-unknown-unknown"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp lib.rs $TmpDir"
rlRun "cp test.js $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "rustc --target wasm32-unknown-unknown --crate-type=cdylib lib.rs -o fib.wasm" 0 "Building WASM binary"
rlRun "node test.js" 0 "Testing WASM binary"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,28 @@
function js_fibonacci(index) {
let nminus2 = 0;
let nminus1 = 1;
let n = 0;
for(let i = 0; i < index; ++i) {
nminus2 = nminus1;
nminus1 = n;
n = nminus1 + nminus2;
}
return n;
}
const fs = require('fs');
const buf = fs.readFileSync('./fib.wasm');
const lib = WebAssembly.instantiate(new Uint8Array(buf)).
then(res => {
var fib = res.instance.exports.fib;
for (var i=1; i<=10; i++) {
if(fib(i) != js_fibonacci(i)){
console.log("Mismatch between wasm and JS functions");
process.exit(1);
}
}
}).catch(e => {
console.log(e);
process.exit(1);
}
);