Skip to content

Commit 73bf794

Browse files
committed
Auto merge of rust-lang#136715 - bjorn3:sync_cg_clif-2025-02-07, r=bjorn3
Subtree sync for rustc_codegen_cranelift The main highlights this time are a Cranelift update and a fix for a warning that the x87 feature is not enabled. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler<!-- homu-ignore:start -->
2 parents 8ad2c97 + cac271f commit 73bf794

File tree

12 files changed

+97
-71
lines changed

12 files changed

+97
-71
lines changed

compiler/rustc_codegen_cranelift/Cargo.lock

+30-30
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,24 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
4343

4444
[[package]]
4545
name = "cranelift-bforest"
46-
version = "0.115.0"
46+
version = "0.116.1"
4747
source = "registry+https://github.com/rust-lang/crates.io-index"
48-
checksum = "ac89549be94911dd0e839b4a7db99e9ed29c17517e1c026f61066884c168aa3c"
48+
checksum = "e15d04a0ce86cb36ead88ad68cf693ffd6cda47052b9e0ac114bc47fd9cd23c4"
4949
dependencies = [
5050
"cranelift-entity",
5151
]
5252

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

5959
[[package]]
6060
name = "cranelift-codegen"
61-
version = "0.115.0"
61+
version = "0.116.1"
6262
source = "registry+https://github.com/rust-lang/crates.io-index"
63-
checksum = "fd96ce9cf8efebd7f5ab8ced5a0ce44250280bbae9f593d74a6d7effc3582a35"
63+
checksum = "2c22032c4cb42558371cf516bb47f26cdad1819d3475c133e93c49f50ebf304e"
6464
dependencies = [
6565
"bumpalo",
6666
"cranelift-bforest",
@@ -82,42 +82,42 @@ dependencies = [
8282

8383
[[package]]
8484
name = "cranelift-codegen-meta"
85-
version = "0.115.0"
85+
version = "0.116.1"
8686
source = "registry+https://github.com/rust-lang/crates.io-index"
87-
checksum = "5a68e358827afe4bfb6239fcbf6fbd5ac56206ece8a99c8f5f9bbd518773281a"
87+
checksum = "c904bc71c61b27fc57827f4a1379f29de64fe95653b620a3db77d59655eee0b8"
8888
dependencies = [
8989
"cranelift-codegen-shared",
9090
]
9191

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

9898
[[package]]
9999
name = "cranelift-control"
100-
version = "0.115.0"
100+
version = "0.116.1"
101101
source = "registry+https://github.com/rust-lang/crates.io-index"
102-
checksum = "5cc7664f2a66f053e33f149e952bb5971d138e3af637f5097727ed6dc0ed95dd"
102+
checksum = "26d132c6d0bd8a489563472afc171759da0707804a65ece7ceb15a8c6d7dd5ef"
103103
dependencies = [
104104
"arbitrary",
105105
]
106106

107107
[[package]]
108108
name = "cranelift-entity"
109-
version = "0.115.0"
109+
version = "0.116.1"
110110
source = "registry+https://github.com/rust-lang/crates.io-index"
111-
checksum = "118597e3a9cf86c3556fa579a7a23b955fa18231651a52a77a2475d305a9cf84"
111+
checksum = "4b2d0d9618275474fbf679dd018ac6e009acbd6ae6850f6a67be33fb3b00b323"
112112
dependencies = [
113113
"cranelift-bitset",
114114
]
115115

116116
[[package]]
117117
name = "cranelift-frontend"
118-
version = "0.115.0"
118+
version = "0.116.1"
119119
source = "registry+https://github.com/rust-lang/crates.io-index"
120-
checksum = "7638ea1efb069a0aa18d8ee67401b6b0d19f6bfe5de5e9ede348bfc80bb0d8c7"
120+
checksum = "4fac41e16729107393174b0c9e3730fb072866100e1e64e80a1a963b2e484d57"
121121
dependencies = [
122122
"cranelift-codegen",
123123
"log",
@@ -127,15 +127,15 @@ dependencies = [
127127

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

134134
[[package]]
135135
name = "cranelift-jit"
136-
version = "0.115.0"
136+
version = "0.116.1"
137137
source = "registry+https://github.com/rust-lang/crates.io-index"
138-
checksum = "36972cab12ff246afe8d45b6a427669cf814bd393c661e5e8a8dedc26a81c73f"
138+
checksum = "5e65c42755a719b09662b00c700daaf76cc35d5ace1f5c002ad404b591ff1978"
139139
dependencies = [
140140
"anyhow",
141141
"cranelift-codegen",
@@ -153,9 +153,9 @@ dependencies = [
153153

154154
[[package]]
155155
name = "cranelift-module"
156-
version = "0.115.0"
156+
version = "0.116.1"
157157
source = "registry+https://github.com/rust-lang/crates.io-index"
158-
checksum = "11841b3f54ac480db1e8e8d5678ba901a13b387012d315e3f8fba3e7b7a80447"
158+
checksum = "4d55612bebcf16ff7306c8a6f5bdb6d45662b8aa1ee058ecce8807ad87db719b"
159159
dependencies = [
160160
"anyhow",
161161
"cranelift-codegen",
@@ -164,9 +164,9 @@ dependencies = [
164164

165165
[[package]]
166166
name = "cranelift-native"
167-
version = "0.115.0"
167+
version = "0.116.1"
168168
source = "registry+https://github.com/rust-lang/crates.io-index"
169-
checksum = "7b7d8f895444fa52dd7bdd0bed11bf007a7fb43af65a6deac8fcc4094c6372f7"
169+
checksum = "b8dee82f3f1f2c4cba9177f1cc5e350fe98764379bcd29340caa7b01f85076c7"
170170
dependencies = [
171171
"cranelift-codegen",
172172
"libc",
@@ -175,9 +175,9 @@ dependencies = [
175175

176176
[[package]]
177177
name = "cranelift-object"
178-
version = "0.115.0"
178+
version = "0.116.1"
179179
source = "registry+https://github.com/rust-lang/crates.io-index"
180-
checksum = "8e235ddfd19f100855ad03358c7ae0a13070c38a000701054cab46458cca6e81"
180+
checksum = "aad5a6d3e379493c3f8b35dc61c93d0bf5f27003bbe20614e0200b0ec372ef52"
181181
dependencies = [
182182
"anyhow",
183183
"cranelift-codegen",
@@ -413,9 +413,9 @@ dependencies = [
413413

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

420420
[[package]]
421421
name = "unicode-ident"
@@ -425,9 +425,9 @@ checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
425425

426426
[[package]]
427427
name = "wasmtime-jit-icache-coherence"
428-
version = "28.0.0"
428+
version = "29.0.1"
429429
source = "registry+https://github.com/rust-lang/crates.io-index"
430-
checksum = "d40d7722b9e1fbeae135715710a8a2570b1e6cf72b74dd653962d89831c6c70d"
430+
checksum = "ec5e8552e01692e6c2e5293171704fed8abdec79d1a6995a0870ab190e5747d1"
431431
dependencies = [
432432
"anyhow",
433433
"cfg-if",

compiler/rustc_codegen_cranelift/Cargo.toml

+13-13
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ crate-type = ["dylib"]
88

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

@@ -24,12 +24,12 @@ smallvec = "1.8.1"
2424

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

3434
# Uncomment to use local checkout of cranelift
3535
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }

compiler/rustc_codegen_cranelift/build_system/prepare.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn init_git_repo(repo_dir: &Path) {
186186
spawn_and_wait(git_add_cmd);
187187

188188
let mut git_commit_cmd = git_command(repo_dir, "commit");
189-
git_commit_cmd.arg("-m").arg("Initial commit").arg("-q");
189+
git_commit_cmd.arg("-m").arg("Initial commit").arg("-q").arg("--no-verify");
190190
spawn_and_wait(git_commit_cmd);
191191
}
192192

compiler/rustc_codegen_cranelift/build_system/tests.rs

-8
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,6 @@ impl<'a> TestRunner<'a> {
330330
target_compiler.rustflags.extend(rustflags_from_env("RUSTFLAGS"));
331331
target_compiler.rustdocflags.extend(rustflags_from_env("RUSTDOCFLAGS"));
332332

333-
// FIXME fix `#[linkage = "extern_weak"]` without this
334-
if target_compiler.triple.contains("darwin") {
335-
target_compiler.rustflags.extend([
336-
"-Clink-arg=-undefined".to_owned(),
337-
"-Clink-arg=dynamic_lookup".to_owned(),
338-
]);
339-
}
340-
341333
let jit_supported = use_unstable_features
342334
&& is_native
343335
&& target_compiler.triple.contains("x86_64")

compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fn main() {
274274

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

277-
#[cfg(not(any(jit, windows)))]
277+
#[cfg(not(any(jit, target_vendor = "apple", windows)))]
278278
{
279279
extern "C" {
280280
#[linkage = "extern_weak"]

compiler/rustc_codegen_cranelift/patches/0028-coretests-Disable-long-running-tests.patch

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ index 8402833..84592e0 100644
3636
#[cfg(not(miri))] // unused in Miri
3737
macro_rules! empty_max_mut {
3838
@@ -2485,6 +2486,7 @@ take_tests! {
39-
(take_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()),
40-
(take_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()),
39+
(split_off_mut_oob_max_range_to_inclusive, (..=usize::MAX), None, empty_max_mut!()),
40+
(split_off_mut_in_bounds_max_range_from, (usize::MAX..), Some(&mut [] as _), empty_max_mut!()),
4141
}
4242
+*/
4343

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2025-01-20"
2+
channel = "nightly-2025-02-07"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
44
profile = "minimal"

compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh

+16-6
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,18 @@ rm tests/ui/match/match-float.rs
8383
# ==================
8484
rm tests/ui/codegen/issue-28950.rs # depends on stack size optimizations
8585
rm tests/ui/codegen/init-large-type.rs # same
86-
rm tests/ui/issues/issue-40883.rs # same
8786
rm -r tests/run-make/fmt-write-bloat/ # tests an optimization
8887
rm tests/ui/statics/const_generics.rs # same
8988

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

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

201211
echo "[TEST] rustc test suite"

compiler/rustc_codegen_cranelift/src/compiler_builtins.rs

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ builtin_functions! {
4444
fn __umodti3(n: u128, d: u128) -> u128;
4545
fn __modti3(n: i128, d: i128) -> i128;
4646
fn __rust_u128_mulo(a: u128, b: u128, oflow: &mut i32) -> u128;
47+
fn __rust_i128_mulo(a: i128, b: i128, oflow: &mut i32) -> i128;
4748

4849
// floats
4950
fn __floattisf(i: i128) -> f32;

compiler/rustc_codegen_cranelift/src/driver/jit.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ unsafe impl Send for UnsafeMessage {}
4646

4747
impl UnsafeMessage {
4848
/// Send the message.
49-
fn send(self) -> Result<(), mpsc::SendError<UnsafeMessage>> {
49+
fn send(self) {
5050
thread_local! {
5151
/// The Sender owned by the local thread
5252
static LOCAL_MESSAGE_SENDER: mpsc::Sender<UnsafeMessage> =
@@ -55,7 +55,9 @@ impl UnsafeMessage {
5555
.lock().unwrap()
5656
.clone();
5757
}
58-
LOCAL_MESSAGE_SENDER.with(|sender| sender.send(self))
58+
LOCAL_MESSAGE_SENDER.with(|sender| {
59+
sender.send(self).expect("rustc thread hung up before lazy JIT request was sent")
60+
})
5961
}
6062
}
6163

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

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

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

0 commit comments

Comments
 (0)