Skip to content

Commit a69df72

Browse files
committed
Auto merge of #132664 - matthiaskrgr:rollup-i27nr7i, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #131261 (Stabilize `UnsafeCell::from_mut`) - #131405 (bootstrap/codegen_ssa: ship llvm-strip and use it for -Cstrip) - #132077 (Add a new `wide-arithmetic` feature for WebAssembly) - #132562 (Remove the `wasm32-wasi` target from rustc) - #132660 (Remove unused errs.rs file) Failed merges: - #131721 (Add new unstable feature `const_eq_ignore_ascii_case`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4a91ff6 + 92c1ad8 commit a69df72

File tree

25 files changed

+65
-151
lines changed

25 files changed

+65
-151
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
277277
("x86", s) if s.starts_with("avx512") => {
278278
Some(LLVMFeature::with_dependency(s, TargetFeatureFoldStrength::EnableOnly("evex512")))
279279
}
280+
// Support for `wide-arithmetic` will first land in LLVM 20 as part of
281+
// llvm/llvm-project#111598
282+
("wasm32" | "wasm64", "wide-arithmetic") if get_version() < (20, 0, 0) => None,
280283
(_, s) => Some(LLVMFeature::new(s)),
281284
}
282285
}

compiler/rustc_codegen_ssa/messages.ftl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ codegen_ssa_L4Bender_exporting_symbols_unimplemented = exporting symbols not imp
22
33
codegen_ssa_add_native_library = failed to add native library {$library_path}: {$error}
44
5+
codegen_ssa_aix_strip_not_used = using host's `strip` binary to cross-compile to AIX which is not guaranteed to work
6+
57
codegen_ssa_apple_deployment_target_invalid =
68
failed to parse deployment target specified in {$env_var}: {$error}
79

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,9 +1085,7 @@ fn link_natively(
10851085
let strip = sess.opts.cg.strip;
10861086

10871087
if sess.target.is_like_osx {
1088-
// Use system `strip` when running on host macOS.
1089-
// <https://github.com/rust-lang/rust/pull/130781>
1090-
let stripcmd = if cfg!(target_os = "macos") { "/usr/bin/strip" } else { "strip" };
1088+
let stripcmd = "rust-objcopy";
10911089
match (strip, crate_type) {
10921090
(Strip::Debuginfo, _) => {
10931091
strip_symbols_with_external_utility(sess, stripcmd, out_filename, Some("-S"))
@@ -1103,11 +1101,14 @@ fn link_natively(
11031101
}
11041102
}
11051103

1106-
if sess.target.os == "illumos" {
1104+
if sess.target.is_like_solaris {
11071105
// Many illumos systems will have both the native 'strip' utility and
11081106
// the GNU one. Use the native version explicitly and do not rely on
11091107
// what's in the path.
1110-
let stripcmd = "/usr/bin/strip";
1108+
//
1109+
// If cross-compiling and there is not a native version, then use
1110+
// `llvm-strip` and hope.
1111+
let stripcmd = if !sess.host.is_like_solaris { "rust-objcopy" } else { "/usr/bin/strip" };
11111112
match strip {
11121113
// Always preserve the symbol table (-x).
11131114
Strip::Debuginfo => {
@@ -1120,6 +1121,10 @@ fn link_natively(
11201121
}
11211122

11221123
if sess.target.is_like_aix {
1124+
// `llvm-strip` doesn't work for AIX - their strip must be used.
1125+
if !sess.host.is_like_aix {
1126+
sess.dcx().emit_warn(errors::AixStripNotUsed);
1127+
}
11231128
let stripcmd = "/usr/bin/strip";
11241129
match strip {
11251130
Strip::Debuginfo => {
@@ -1147,6 +1152,13 @@ fn strip_symbols_with_external_utility(
11471152
if let Some(option) = option {
11481153
cmd.arg(option);
11491154
}
1155+
1156+
let mut new_path = sess.get_tools_search_paths(false);
1157+
if let Some(path) = env::var_os("PATH") {
1158+
new_path.extend(env::split_paths(&path));
1159+
}
1160+
cmd.env("PATH", env::join_paths(new_path).unwrap());
1161+
11501162
let prog = cmd.arg(out_filename).output();
11511163
match prog {
11521164
Ok(prog) => {

compiler/rustc_codegen_ssa/src/errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,3 +1110,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_
11101110
diag
11111111
}
11121112
}
1113+
1114+
#[derive(Diagnostic)]
1115+
#[diag(codegen_ssa_aix_strip_not_used)]
1116+
pub(crate) struct AixStripNotUsed;

compiler/rustc_hir_analysis/src/check/errs.rs

Lines changed: 0 additions & 88 deletions
This file was deleted.

compiler/rustc_session/src/config.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,19 +1351,6 @@ pub fn build_target_config(early_dcx: &EarlyDiagCtxt, opts: &Options, sysroot: &
13511351
early_dcx.early_warn(warning)
13521352
}
13531353

1354-
// The `wasm32-wasi` target is being renamed to `wasm32-wasip1` as
1355-
// part of rust-lang/compiler-team#607 and
1356-
// rust-lang/compiler-team#695. Warn unconditionally on usage to
1357-
// raise awareness of the renaming. This code will be deleted in
1358-
// October 2024.
1359-
if opts.target_triple.tuple() == "wasm32-wasi" {
1360-
early_dcx.early_warn(
1361-
"the `wasm32-wasi` target is being renamed to \
1362-
`wasm32-wasip1` and the `wasm32-wasi` target will be \
1363-
removed from nightly in October 2024 and removed from \
1364-
stable Rust in January 2025",
1365-
)
1366-
}
13671354
if !matches!(target.pointer_width, 16 | 32 | 64) {
13681355
early_dcx.early_fatal(format!(
13691356
"target specification was invalid: unrecognized target-pointer-width {}",

compiler/rustc_target/src/spec/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,6 @@ supported_targets! {
18051805
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
18061806
("wasm32-unknown-unknown", wasm32_unknown_unknown),
18071807
("wasm32v1-none", wasm32v1_none),
1808-
("wasm32-wasi", wasm32_wasi),
18091808
("wasm32-wasip1", wasm32_wasip1),
18101809
("wasm32-wasip2", wasm32_wasip2),
18111810
("wasm32-wasip1-threads", wasm32_wasip1_threads),

compiler/rustc_target/src/spec/targets/wasm32_wasi.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
1717

1818
options.os = "wasi".into();
1919
options.env = "p1".into();
20-
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]);
20+
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasip1"]);
2121

2222
options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
2323
options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@@ -47,7 +47,7 @@ pub(crate) fn target() -> Target {
4747
options.entry_name = "__main_void".into();
4848

4949
Target {
50-
llvm_target: "wasm32-wasi".into(),
50+
llvm_target: "wasm32-wasip1".into(),
5151
metadata: crate::spec::TargetMetadata {
5252
description: Some("WebAssembly with WASI".into()),
5353
tier: Some(2),

compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! The `wasm32-wasip2` target is the next evolution of the
2-
//! wasm32-wasi target. While the wasi specification is still under
2+
//! wasm32-wasip1 target. While the wasi specification is still under
33
//! active development, the preview 2 iteration is considered an "island
44
//! of stability" that should allow users to rely on it indefinitely.
55
//!

0 commit comments

Comments
 (0)