Compare commits

...

No commits in common. 'c9' and 'c8-stream-rhel_next' have entirely different histories.

2
.gitignore vendored

@ -1,2 +1,2 @@
SOURCES/rustc-1.76.0-src.tar.xz SOURCES/rustc-1.78.0-src.tar.xz
SOURCES/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz SOURCES/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz

@ -1,2 +1,2 @@
755339e8131d618d3c1095a581f27afc573ad310 SOURCES/rustc-1.76.0-src.tar.xz 0e47db96dd07c4632695a9adddcbc077a0500cc3 SOURCES/rustc-1.78.0-src.tar.xz
124d114ffb627ada36bfa1df0216bcea0f55a15e SOURCES/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz 124d114ffb627ada36bfa1df0216bcea0f55a15e SOURCES/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz

@ -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

@ -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

@ -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

@ -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

@ -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

@ -48,6 +48,18 @@ index 5abfb8162f70..13cb43bda1a4 100644
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to // 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 // 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),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
features: "+v8a,+strict-align,-neon,-fp-armv8".into(),
relocation_model: RelocModel::Static,
disable_redzone: true,
-- --
2.41.0 2.41.0

@ -1,4 +1,4 @@
From df0d6f1d8b46db82d7599ca8eff6e8f844cf52f2 Mon Sep 17 00:00:00 2001 From 2b99134e2884fa56bcab6d360885ec5421048e66 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com> From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700 Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
@ -11,12 +11,12 @@ Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
4 files changed, 22 insertions(+) 4 files changed, 22 insertions(+)
diff --git a/config.example.toml b/config.example.toml diff --git a/config.example.toml b/config.example.toml
index e5df28a49af6..2fcd8b8cb057 100644 index f94553dd63f7..5ec969c80a37 100644
--- a/config.example.toml --- a/config.example.toml
+++ b/config.example.toml +++ b/config.example.toml
@@ -807,6 +807,11 @@ change-id = 116881 @@ -869,6 +869,11 @@
# target triples containing `-none`, `nvptx`, `switch`, or `-uefi`. # argument as the test binary.
#no-std = <platform-specific> (bool) #runner = <none> (string)
+# Copy libc and CRT objects into the target lib/self-contained/ directory. +# Copy libc and CRT objects into the target lib/self-contained/ directory.
+# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other +# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other
@ -27,10 +27,10 @@ index e5df28a49af6..2fcd8b8cb057 100644
# Distribution options # Distribution options
# #
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 7021a9543582..11555c65ca87 100644 index e927b491c71e..69a80d01d6b9 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs --- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -302,6 +302,10 @@ fn copy_self_contained_objects( @@ -356,6 +356,10 @@ fn copy_self_contained_objects(
compiler: &Compiler, compiler: &Compiler,
target: TargetSelection, target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> { ) -> Vec<(PathBuf, DependencyType)> {
@ -42,18 +42,18 @@ index 7021a9543582..11555c65ca87 100644
t!(fs::create_dir_all(&libdir_self_contained)); t!(fs::create_dir_all(&libdir_self_contained));
let mut target_deps = vec![]; let mut target_deps = vec![];
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 0a9175aa3ea5..a2e028b25036 100644 index 3e1bc9a9acdd..5e24a9cc4f60 100644
--- a/src/bootstrap/src/core/config/config.rs --- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs
@@ -533,6 +533,7 @@ pub struct Target { @@ -586,6 +586,7 @@ pub struct Target {
pub wasi_root: Option<PathBuf>, pub runner: Option<String>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool, pub no_std: bool,
pub codegen_backends: Option<Vec<String>>,
+ pub self_contained: bool, + pub self_contained: bool,
} }
impl Target { impl Target {
@@ -541,6 +542,9 @@ pub fn from_triple(triple: &str) -> Self { @@ -594,6 +595,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") { if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true; target.no_std = true;
} }
@ -63,15 +63,15 @@ index 0a9175aa3ea5..a2e028b25036 100644
target target
} }
} }
@@ -1051,6 +1055,7 @@ struct TomlTarget { @@ -1150,6 +1154,7 @@ struct TomlTarget {
wasi_root: Option<String> = "wasi-root",
qemu_rootfs: Option<String> = "qemu-rootfs",
no_std: Option<bool> = "no-std", no_std: Option<bool> = "no-std",
codegen_backends: Option<Vec<String>> = "codegen-backends",
runner: Option<String> = "runner",
+ self_contained: Option<bool> = "self-contained", + self_contained: Option<bool> = "self-contained",
} }
} }
@@ -1600,6 +1605,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> { @@ -1870,6 +1875,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std { if let Some(s) = cfg.no_std {
target.no_std = s; target.no_std = s;
} }
@ -82,10 +82,10 @@ index 0a9175aa3ea5..a2e028b25036 100644
target.cxx = cfg.cxx.map(PathBuf::from); target.cxx = cfg.cxx.map(PathBuf::from);
target.ar = cfg.ar.map(PathBuf::from); target.ar = cfg.ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 33b8f1a7ce72..f36e53187576 100644 index 5ed6b357e20a..c23b21d65713 100644
--- a/src/bootstrap/src/lib.rs --- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs
@@ -1335,6 +1335,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) self.config.target_config.get(&target).map(|t| t.no_std)
} }
@ -98,5 +98,5 @@ index 33b8f1a7ce72..f36e53187576 100644
/// and `remote-test-server` binaries. /// and `remote-test-server` binaries.
fn remote_tested(&self, target: TargetSelection) -> bool { fn remote_tested(&self, target: TargetSelection) -> bool {
-- --
2.41.0 2.44.0

@ -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

@ -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

@ -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

@ -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

@ -1,19 +1,19 @@
From 79bb610c8fc5d9df7dd4720ae847b8f17e7b1ad4 Mon Sep 17 00:00:00 2001 From e3b7d2e3d3b4fcbc6591de606957c0fd59b5e547 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com> From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700 Date: Thu, 28 Sep 2023 18:18:16 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi Subject: [PATCH 2/2] set an external library path for wasm32-wasi
--- ---
compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++ compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++
compiler/rustc_target/src/spec/mod.rs | 2 ++ compiler/rustc_target/src/spec/mod.rs | 4 ++++
compiler/rustc_target/src/spec/targets/wasm32_wasi.rs | 6 +++++- compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++---
3 files changed, 16 insertions(+), 1 deletion(-) 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 diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index dd9d277fb775..3d0f0502f255 100644 index f5e8d5fc92a9..f4ad3f725427 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs --- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1496,6 +1496,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; return file_path;
} }
} }
@ -26,7 +26,7 @@ index dd9d277fb775..3d0f0502f255 100644
for search_path in fs.search_paths() { for search_path in fs.search_paths() {
let file_path = search_path.dir.join(name); let file_path = search_path.dir.join(name);
if file_path.exists() { if file_path.exists() {
@@ -1982,6 +1988,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained: @@ -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(); let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path();
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
} }
@ -37,10 +37,10 @@ index dd9d277fb775..3d0f0502f255 100644
/// Add options making relocation sections in the produced ELF files read-only /// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index f04799482c83..25410b37ba24 100644 index 941d767b850d..cd0a2ce51989 100644
--- a/compiler/rustc_target/src/spec/mod.rs --- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1874,6 +1874,7 @@ pub struct TargetOptions { @@ -1881,6 +1881,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code. /// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects, pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects, pub post_link_objects: CrtObjects,
@ -48,7 +48,7 @@ index f04799482c83..25410b37ba24 100644
/// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled. /// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled.
pub pre_link_objects_self_contained: CrtObjects, pub pre_link_objects_self_contained: CrtObjects,
pub post_link_objects_self_contained: CrtObjects, pub post_link_objects_self_contained: CrtObjects,
@@ -2352,6 +2353,7 @@ fn default() -> TargetOptions { @@ -2368,6 +2369,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None, relro_level: RelroLevel::None,
pre_link_objects: Default::default(), pre_link_objects: Default::default(),
post_link_objects: Default::default(), post_link_objects: Default::default(),
@ -56,23 +56,42 @@ index f04799482c83..25410b37ba24 100644
pre_link_objects_self_contained: Default::default(), pre_link_objects_self_contained: Default::default(),
post_link_objects_self_contained: Default::default(), post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False, link_self_contained: LinkSelfContainedDefault::False,
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs @@ -3064,6 +3066,7 @@ macro_rules! key {
index 6dbcb01ea436..2151f86d0648 100644 key!(linker_is_gnu_json = "linker-is-gnu", bool);
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs key!(pre_link_objects = "pre-link-objects", link_objects);
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs key!(post_link_objects = "post-link-objects", link_objects);
@@ -86,7 +86,11 @@ pub fn target() -> Target { + key!(external_lib_path, optional);
options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained(); 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 7cbe9f09e6ca..b524890c2ec5 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -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();
+ options.pre_link_objects = crt_objects::pre_wasi_self_contained();
+ options.post_link_objects = crt_objects::post_wasi_self_contained();
// FIXME: Figure out cases in which WASM needs to link with a native toolchain. // FIXME: Figure out cases in which WASM needs to link with a native toolchain.
- options.link_self_contained = LinkSelfContainedDefault::True; - options.link_self_contained = LinkSelfContainedDefault::True;
+ options.link_self_contained = LinkSelfContainedDefault::False; + options.link_self_contained = LinkSelfContainedDefault::False;
+
+ options.pre_link_objects = options.pre_link_objects_self_contained.clone();
+ options.post_link_objects = options.post_link_objects_self_contained.clone();
+ options.external_lib_path = Some("/usr/wasm32-wasi/lib/wasm32-wasi".into()); + options.external_lib_path = Some("/usr/wasm32-wasi/lib/wasm32-wasi".into());
// Right now this is a bit of a workaround but we're currently saying that // 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 // the target by default has a static crt which we're taking as a signal
-- --
2.41.0 2.44.0

@ -29,12 +29,6 @@
# -Copt-level: set optimization level (default: highest optimization level) # -Copt-level: set optimization level (default: highest optimization level)
# -Cdebuginfo: set debuginfo verbosity (default: full debug information) # -Cdebuginfo: set debuginfo verbosity (default: full debug information)
# -Ccodegen-units: set number of parallel code generation units (default: 1) # -Ccodegen-units: set number of parallel code generation units (default: 1)
# -Cforce-frame-pointers: force inclusion of frame pointers (default: enabled
# on x86_64 and aarch64 on Fedora 37+)
#
# Additionally, some linker flags are set which correspond to the default
# Fedora compiler flags for hardening and for embedding package versions into
# compiled binaries.
# #
# ref. https://doc.rust-lang.org/rustc/codegen-options/index.html # ref. https://doc.rust-lang.org/rustc/codegen-options/index.html
%build_rustflags %{shrink: %build_rustflags %{shrink:
@ -42,13 +36,11 @@
-Cdebuginfo=%rustflags_debuginfo -Cdebuginfo=%rustflags_debuginfo
-Ccodegen-units=%rustflags_codegen_units -Ccodegen-units=%rustflags_codegen_units
-Cstrip=none -Cstrip=none
%{expr:0%{?_include_frame_pointers} && ("%{_arch}" != "ppc64le" && "%{_arch}" != "s390x" && "%{_arch}" != "i386") ? "-Cforce-frame-pointers=yes" : ""}
%[0%{?_package_note_status} ? "-Clink-arg=%_package_note_flags" : ""]
} }
# __cargo: cargo command with environment variables # __cargo: cargo command with environment variables
# #
# CARGO_HOME: This ensures cargo reads configuration file from .cargo/config, # CARGO_HOME: This ensures cargo reads configuration file from .cargo/config.toml,
# and prevents writing any files to $HOME during RPM builds. # and prevents writing any files to $HOME during RPM builds.
%__cargo /usr/bin/env CARGO_HOME=.cargo RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo %__cargo /usr/bin/env CARGO_HOME=.cargo RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo
@ -61,7 +53,7 @@
# #
# This involves four steps: # This involves four steps:
# - create the ".cargo" directory if it doesn't exist yet # - create the ".cargo" directory if it doesn't exist yet
# - dump custom cargo configuration into ".cargo/config" # - dump custom cargo configuration into ".cargo/config.toml"
# - remove "Cargo.lock" if it exists (it breaks builds with custom 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") # - remove "Cargo.toml.orig" if it exists (it breaks running "cargo package")
# #
@ -79,7 +71,7 @@ set -euo pipefail\
/usr/bin/ln -s rpm target/release\ /usr/bin/ln -s rpm target/release\
%{__rm} -rf .cargo/\ %{__rm} -rf .cargo/\
%{__mkdir} -p .cargo\ %{__mkdir} -p .cargo\
cat > .cargo/config << EOF\ cat > .cargo/config.toml << EOF\
[build]\ [build]\
rustc = "%{__rustc}"\ rustc = "%{__rustc}"\
rustdoc = "%{__rustdoc}"\ rustdoc = "%{__rustdoc}"\
@ -104,7 +96,7 @@ verbose = true\
EOF\ EOF\
%{-V:%{__tar} -xoaf %{S:%{-V*}}}\ %{-V:%{__tar} -xoaf %{S:%{-V*}}}\
%{!?-N:\ %{!?-N:\
cat >> .cargo/config << EOF\ cat >> .cargo/config.toml << EOF\
[source.vendored-sources]\ [source.vendored-sources]\
directory = "%{-v*}%{-V:./vendor}"\ directory = "%{-v*}%{-V:./vendor}"\
\ \

@ -1,42 +0,0 @@
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-01-07 18:12:08.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-01-09 15:25:51.519781381 -0800
@@ -2071,7 +2071,6 @@
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2113,20 +2112,6 @@
"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"
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-01-09 15:23:02.369032291 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-01-09 15:24:44.015679666 -0800
@@ -40,7 +40,7 @@
curl-sys = "0.4.70"
filetime = "0.2.22"
flate2 = { version = "1.0.28", default-features = false, features = ["zlib"] }
-git2 = "0.18.1"
+git2 = { version = "0.18.1", default-features = false, features = ["https"] }
git2-curl = "0.19.0"
gix = { version = "0.56.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] }
gix-features-for-configuration-only = { version = "0.35.0", package = "gix-features", features = [ "parallel" ] }

@ -1,21 +0,0 @@
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-01-07 18:12:08.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-01-09 15:36:23.808367445 -0800
@@ -2109,7 +2109,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
dependencies = [
- "cc",
"pkg-config",
"vcpkg",
]
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-01-07 18:12:08.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-01-09 15:36:18.534437627 -0800
@@ -73,7 +73,7 @@
pulldown-cmark = { version = "0.9.3", default-features = false }
rand = "0.8.5"
regex = "1.10.2"
-rusqlite = { version = "0.30.0", features = ["bundled"] }
+rusqlite = { version = "0.30.0", features = [] }
rustfix = { version = "0.7.0", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.9.2"

@ -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" ] }

@ -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"

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save