Skip to content

Commit

Permalink
Auto merge of rust-lang#136734 - matthiaskrgr:rollup-e6v3wwe, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#131282 (std: detect stack overflows in TLS destructors on UNIX)
 - rust-lang#135696 (std: move `io` module out of `pal`, get rid of `sys_common::io`)
 - rust-lang#136099 (Optimize `Rc::<str>::default()` implementation)
 - rust-lang#136200 (Generate correct terminate block under Wasm EH)
 - rust-lang#136626 (create `initial_rustdoc` field in `Build`)
 - rust-lang#136657 (Make empty-line-after an early clippy lint)
 - rust-lang#136679 (ci: Use largedisk for loongarch)
 - rust-lang#136715 (Subtree sync for rustc_codegen_cranelift)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Feb 8, 2025
2 parents d2f335d + cad519b commit ddea0bb
Show file tree
Hide file tree
Showing 81 changed files with 1,150 additions and 1,046 deletions.
60 changes: 30 additions & 30 deletions compiler/rustc_codegen_cranelift/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "cranelift-bforest"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac89549be94911dd0e839b4a7db99e9ed29c17517e1c026f61066884c168aa3c"
checksum = "e15d04a0ce86cb36ead88ad68cf693ffd6cda47052b9e0ac114bc47fd9cd23c4"
dependencies = [
"cranelift-entity",
]

[[package]]
name = "cranelift-bitset"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9bd49369f76c77e34e641af85d0956869237832c118964d08bf5f51f210875a"
checksum = "7c6e3969a7ce267259ce244b7867c5d3bc9e65b0a87e81039588dfdeaede9f34"

[[package]]
name = "cranelift-codegen"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd96ce9cf8efebd7f5ab8ced5a0ce44250280bbae9f593d74a6d7effc3582a35"
checksum = "2c22032c4cb42558371cf516bb47f26cdad1819d3475c133e93c49f50ebf304e"
dependencies = [
"bumpalo",
"cranelift-bforest",
Expand All @@ -82,42 +82,42 @@ dependencies = [

[[package]]
name = "cranelift-codegen-meta"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a68e358827afe4bfb6239fcbf6fbd5ac56206ece8a99c8f5f9bbd518773281a"
checksum = "c904bc71c61b27fc57827f4a1379f29de64fe95653b620a3db77d59655eee0b8"
dependencies = [
"cranelift-codegen-shared",
]

[[package]]
name = "cranelift-codegen-shared"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e184c9767afbe73d50c55ec29abcf4c32f9baf0d9d22b86d58c4d55e06dee181"
checksum = "40180f5497572f644ce88c255480981ae2ec1d7bb4d8e0c0136a13b87a2f2ceb"

[[package]]
name = "cranelift-control"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cc7664f2a66f053e33f149e952bb5971d138e3af637f5097727ed6dc0ed95dd"
checksum = "26d132c6d0bd8a489563472afc171759da0707804a65ece7ceb15a8c6d7dd5ef"
dependencies = [
"arbitrary",
]

[[package]]
name = "cranelift-entity"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "118597e3a9cf86c3556fa579a7a23b955fa18231651a52a77a2475d305a9cf84"
checksum = "4b2d0d9618275474fbf679dd018ac6e009acbd6ae6850f6a67be33fb3b00b323"
dependencies = [
"cranelift-bitset",
]

[[package]]
name = "cranelift-frontend"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7638ea1efb069a0aa18d8ee67401b6b0d19f6bfe5de5e9ede348bfc80bb0d8c7"
checksum = "4fac41e16729107393174b0c9e3730fb072866100e1e64e80a1a963b2e484d57"
dependencies = [
"cranelift-codegen",
"log",
Expand All @@ -127,15 +127,15 @@ dependencies = [

[[package]]
name = "cranelift-isle"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15c53e1152a0b01c4ed2b1e0535602b8e86458777dd9d18b28732b16325c7dc0"
checksum = "1ca20d576e5070044d0a72a9effc2deacf4d6aa650403189d8ea50126483944d"

[[package]]
name = "cranelift-jit"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36972cab12ff246afe8d45b6a427669cf814bd393c661e5e8a8dedc26a81c73f"
checksum = "5e65c42755a719b09662b00c700daaf76cc35d5ace1f5c002ad404b591ff1978"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -153,9 +153,9 @@ dependencies = [

[[package]]
name = "cranelift-module"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11841b3f54ac480db1e8e8d5678ba901a13b387012d315e3f8fba3e7b7a80447"
checksum = "4d55612bebcf16ff7306c8a6f5bdb6d45662b8aa1ee058ecce8807ad87db719b"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand All @@ -164,9 +164,9 @@ dependencies = [

[[package]]
name = "cranelift-native"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b7d8f895444fa52dd7bdd0bed11bf007a7fb43af65a6deac8fcc4094c6372f7"
checksum = "b8dee82f3f1f2c4cba9177f1cc5e350fe98764379bcd29340caa7b01f85076c7"
dependencies = [
"cranelift-codegen",
"libc",
Expand All @@ -175,9 +175,9 @@ dependencies = [

[[package]]
name = "cranelift-object"
version = "0.115.0"
version = "0.116.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e235ddfd19f100855ad03358c7ae0a13070c38a000701054cab46458cca6e81"
checksum = "aad5a6d3e379493c3f8b35dc61c93d0bf5f27003bbe20614e0200b0ec372ef52"
dependencies = [
"anyhow",
"cranelift-codegen",
Expand Down Expand Up @@ -413,9 +413,9 @@ dependencies = [

[[package]]
name = "target-lexicon"
version = "0.12.16"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
checksum = "dc12939a1c9b9d391e0b7135f72fd30508b73450753e28341fed159317582a77"

[[package]]
name = "unicode-ident"
Expand All @@ -425,9 +425,9 @@ checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"

[[package]]
name = "wasmtime-jit-icache-coherence"
version = "28.0.0"
version = "29.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d40d7722b9e1fbeae135715710a8a2570b1e6cf72b74dd653962d89831c6c70d"
checksum = "ec5e8552e01692e6c2e5293171704fed8abdec79d1a6995a0870ab190e5747d1"
dependencies = [
"anyhow",
"cfg-if",
Expand Down
26 changes: 13 additions & 13 deletions compiler/rustc_codegen_cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ crate-type = ["dylib"]

[dependencies]
# These have to be in sync with each other
cranelift-codegen = { version = "0.115.0", default-features = false, features = ["std", "unwind", "all-native-arch"] }
cranelift-frontend = { version = "0.115.0" }
cranelift-module = { version = "0.115.0" }
cranelift-native = { version = "0.115.0" }
cranelift-jit = { version = "0.115.0", optional = true }
cranelift-object = { version = "0.115.0" }
target-lexicon = "0.12.0"
cranelift-codegen = { version = "0.116.0", default-features = false, features = ["std", "unwind", "all-native-arch"] }
cranelift-frontend = { version = "0.116.0" }
cranelift-module = { version = "0.116.0" }
cranelift-native = { version = "0.116.0" }
cranelift-jit = { version = "0.116.0", optional = true }
cranelift-object = { version = "0.116.0" }
target-lexicon = "0.13"
gimli = { version = "0.31", default-features = false, features = ["write"] }
object = { version = "0.36", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }

Expand All @@ -24,12 +24,12 @@ smallvec = "1.8.1"

[patch.crates-io]
# Uncomment to use an unreleased version of cranelift
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-28.0.0", version = "0.115.0" }
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-28.0.0", version = "0.115.0" }
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-28.0.0", version = "0.115.0" }
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-28.0.0", version = "0.115.0" }
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-28.0.0", version = "0.115.0" }
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-28.0.0", version = "0.115.0" }
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-29.0.0", version = "0.116.0" }
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-29.0.0", version = "0.116.0" }
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-29.0.0", version = "0.116.0" }
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-29.0.0", version = "0.116.0" }
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-29.0.0", version = "0.116.0" }
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-29.0.0", version = "0.116.0" }

# Uncomment to use local checkout of cranelift
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/build_system/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fn init_git_repo(repo_dir: &Path) {
spawn_and_wait(git_add_cmd);

let mut git_commit_cmd = git_command(repo_dir, "commit");
git_commit_cmd.arg("-m").arg("Initial commit").arg("-q");
git_commit_cmd.arg("-m").arg("Initial commit").arg("-q").arg("--no-verify");
spawn_and_wait(git_commit_cmd);
}

Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_codegen_cranelift/build_system/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,6 @@ impl<'a> TestRunner<'a> {
target_compiler.rustflags.extend(rustflags_from_env("RUSTFLAGS"));
target_compiler.rustdocflags.extend(rustflags_from_env("RUSTDOCFLAGS"));

// FIXME fix `#[linkage = "extern_weak"]` without this
if target_compiler.triple.contains("darwin") {
target_compiler.rustflags.extend([
"-Clink-arg=-undefined".to_owned(),
"-Clink-arg=dynamic_lookup".to_owned(),
]);
}

let jit_supported = use_unstable_features
&& is_native
&& target_compiler.triple.contains("x86_64")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ fn main() {

assert_eq!(((|()| 42u8) as fn(()) -> u8)(()), 42);

#[cfg(not(any(jit, windows)))]
#[cfg(not(any(jit, target_vendor = "apple", windows)))]
{
extern "C" {
#[linkage = "extern_weak"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ index 8402833..84592e0 100644
#[cfg(not(miri))] // unused in Miri
macro_rules! empty_max_mut {
@@ -2485,6 +2486,7 @@ take_tests! {
(take_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()),
(take_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()),
(split_off_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()),
(split_off_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()),
}
+*/

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2025-01-20"
channel = "nightly-2025-02-07"
components = ["rust-src", "rustc-dev", "llvm-tools"]
profile = "minimal"
22 changes: 16 additions & 6 deletions compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,18 @@ rm tests/ui/match/match-float.rs
# ==================
rm tests/ui/codegen/issue-28950.rs # depends on stack size optimizations
rm tests/ui/codegen/init-large-type.rs # same
rm tests/ui/issues/issue-40883.rs # same
rm -r tests/run-make/fmt-write-bloat/ # tests an optimization
rm tests/ui/statics/const_generics.rs # same

# backend specific tests
# ======================
rm tests/incremental/thinlto/cgu_invalidated_when_import_{added,removed}.rs # requires LLVM
rm -r tests/run-make/cross-lang-lto # same
rm -r tests/run-make/sepcomp-inlining # same
rm -r tests/run-make/sepcomp-separate # same
rm -r tests/run-make/sepcomp-cci-copies # same
rm -r tests/run-make/volatile-intrinsics # same
rm -r tests/run-make/llvm-ident # same
rm -r tests/run-make/no-builtins-attribute # same
rm -r tests/run-make/pgo-gen-no-imp-symbols # same
rm -r tests/run-make/llvm-location-discriminator-limit-dummy-span # same
rm tests/ui/abi/stack-protector.rs # requires stack protector support
rm -r tests/run-make/emit-stack-sizes # requires support for -Z emit-stack-sizes
rm -r tests/run-make/optimization-remarks-dir # remarks are LLVM specific
Expand Down Expand Up @@ -130,6 +127,7 @@ rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift
rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump
rm -r tests/run-make/strip # same
rm -r tests/run-make/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source
rm -r tests/run-make/translation # same
rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features
rm -r tests/run-make/const-trait-stable-toolchain # same
rm -r tests/run-make/incr-add-rust-src-component
Expand All @@ -156,8 +154,6 @@ cp $(../dist/rustc-clif --print target-libdir)/libstd-*.so ../dist/lib/

# prevent $(RUSTDOC) from picking up the sysroot built by x.py. It conflicts with the one used by
# rustdoc-clif
# FIXME remove the bootstrap changes once it is no longer necessary to revert rust-lang/rust#130642
# to avoid building rustc when testing stage0 run-make.
cat <<EOF | git apply -
diff --git a/tests/run-make/tools.mk b/tests/run-make/tools.mk
index ea06b620c4c..b969d0009c6 100644
Expand Down Expand Up @@ -196,6 +192,20 @@ index e7ae773ffa1d3..04bc2d7787da7 100644
// Provide necessary library search paths for rustc.
.env(dylib_env_var(), &env::join_paths(host_dylib_search_paths).unwrap());
diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs
index 30387af428c..f7895b12961 100644
--- a/tests/run-make/linker-warning/rmake.rs
+++ b/tests/run-make/linker-warning/rmake.rs
@@ -57,7 +57,8 @@ fn main() {
.actual_text("(linker error)", out.stderr())
- .normalize(r#"/rustc[^/]*/"#, "/rustc/")
+ .normalize(r#"/tmp/rustc[^/]*/"#, "/tmp/rustc/")
+ .normalize("libpanic_abort", "libpanic_unwind")
.normalize(
regex::escape(run_make_support::build_root().to_str().unwrap()),
"/build-root",
)
.run();
EOF

echo "[TEST] rustc test suite"
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_cranelift/src/compiler_builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ builtin_functions! {
fn __umodti3(n: u128, d: u128) -> u128;
fn __modti3(n: i128, d: i128) -> i128;
fn __rust_u128_mulo(a: u128, b: u128, oflow: &mut i32) -> u128;
fn __rust_i128_mulo(a: i128, b: i128, oflow: &mut i32) -> i128;

// floats
fn __floattisf(i: i128) -> f32;
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_cranelift/src/driver/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ unsafe impl Send for UnsafeMessage {}

impl UnsafeMessage {
/// Send the message.
fn send(self) -> Result<(), mpsc::SendError<UnsafeMessage>> {
fn send(self) {
thread_local! {
/// The Sender owned by the local thread
static LOCAL_MESSAGE_SENDER: mpsc::Sender<UnsafeMessage> =
Expand All @@ -55,7 +55,9 @@ impl UnsafeMessage {
.lock().unwrap()
.clone();
}
LOCAL_MESSAGE_SENDER.with(|sender| sender.send(self))
LOCAL_MESSAGE_SENDER.with(|sender| {
sender.send(self).expect("rustc thread hung up before lazy JIT request was sent")
})
}
}

Expand Down Expand Up @@ -90,7 +92,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, codegen_mode: CodegenMode, jit_args: Vec<
create_jit_module(tcx, matches!(codegen_mode, CodegenMode::JitLazy));
let mut cached_context = Context::new();

let (_, cgus) = tcx.collect_and_partition_mono_items(());
let cgus = tcx.collect_and_partition_mono_items(()).codegen_units;
let mono_items = cgus
.iter()
.map(|cgu| cgu.items_in_deterministic_order(tcx).into_iter())
Expand Down Expand Up @@ -231,9 +233,7 @@ extern "C" fn clif_jit_fn(
) -> *const u8 {
// send the JIT request to the rustc thread, with a channel for the response
let (tx, rx) = mpsc::channel();
UnsafeMessage::JitFn { instance_ptr, trampoline_ptr, tx }
.send()
.expect("rustc thread hung up before lazy JIT request was sent");
UnsafeMessage::JitFn { instance_ptr, trampoline_ptr, tx }.send();

// block on JIT compilation result
rx.recv().expect("rustc thread hung up before responding to sent lazy JIT request")
Expand Down
Loading

0 comments on commit ddea0bb

Please sign in to comment.