Skip to content

Commit 01d73d4

Browse files
committed
Auto merge of rust-lang#122208 - bjorn3:sync_cg_clif-2024-03-08, r=bjorn3
Subtree sync for rustc_codegen_cranelift The main highlight this time is a bunch of new vendor intrinsics. Cranelift has also been updated to 0.105. And there were a bunch of big-endian fixes. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2 parents 46b180e + 8960fe0 commit 01d73d4

20 files changed

+308
-122
lines changed

compiler/rustc_codegen_cranelift/.github/workflows/main.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ jobs:
4444
env:
4545
TARGET_TRIPLE: x86_64-apple-darwin
4646
# cross-compile from Linux to Windows using mingw
47-
- os: ubuntu-latest
48-
env:
49-
TARGET_TRIPLE: x86_64-pc-windows-gnu
47+
# FIXME The wine version in Ubuntu 22.04 is missing ProcessPrng
48+
#- os: ubuntu-latest
49+
# env:
50+
# TARGET_TRIPLE: x86_64-pc-windows-gnu
5051
- os: ubuntu-latest
5152
env:
5253
TARGET_TRIPLE: aarch64-unknown-linux-gnu
@@ -80,11 +81,11 @@ jobs:
8081
if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
8182
run: rustup set default-host x86_64-pc-windows-gnu
8283

83-
- name: Install MinGW toolchain and wine
84-
if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
85-
run: |
86-
sudo apt-get update
87-
sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
84+
#- name: Install MinGW toolchain and wine
85+
# if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
86+
# run: |
87+
# sudo apt-get update
88+
# sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
8889

8990
- name: Install AArch64 toolchain and qemu
9091
if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
+13-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
/target
2-
/build_system/target
3-
**/*.rs.bk
4-
*.rlib
5-
*.o
6-
perf.data
7-
perf.data.old
8-
*.events
9-
*.string*
1+
# Build artifacts during normal use
102
/y.bin
113
/y.bin.dSYM
124
/y.exe
135
/y.pdb
6+
/download
147
/build
158
/dist
9+
/target
10+
/build_system/target
11+
12+
# Downloaded by certain scripts
1613
/rust
17-
/download
1814
/git-fixed-subtree.sh
15+
16+
# Various things that can be created during development
17+
*.rlib
18+
*.o
19+
perf.data
20+
perf.data.old
21+
*.mm_profdata

compiler/rustc_codegen_cranelift/Cargo.lock

+28-28
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
4646

4747
[[package]]
4848
name = "cranelift-bforest"
49-
version = "0.104.0"
49+
version = "0.105.2"
5050
source = "registry+https://github.com/rust-lang/crates.io-index"
51-
checksum = "d819feeda4c420a18f1e28236ca0ce1177b22bf7c8a44ddee92dfe40de15bcf0"
51+
checksum = "9515fcc42b6cb5137f76b84c1a6f819782d0cf12473d145d3bc5cd67eedc8bc2"
5252
dependencies = [
5353
"cranelift-entity",
5454
]
5555

5656
[[package]]
5757
name = "cranelift-codegen"
58-
version = "0.104.0"
58+
version = "0.105.2"
5959
source = "registry+https://github.com/rust-lang/crates.io-index"
60-
checksum = "e9b8d03d5bdbca7e5f72b0e0a0f69933ed1f09e24be6c075aa6fe3f802b0cc0c"
60+
checksum = "1ad827c6071bfe6d22de1bc331296a29f9ddc506ff926d8415b435ec6a6efce0"
6161
dependencies = [
6262
"bumpalo",
6363
"cranelift-bforest",
@@ -76,39 +76,39 @@ dependencies = [
7676

7777
[[package]]
7878
name = "cranelift-codegen-meta"
79-
version = "0.104.0"
79+
version = "0.105.2"
8080
source = "registry+https://github.com/rust-lang/crates.io-index"
81-
checksum = "a3fd3664e38e51649b17dc30cfdd561273fe2f590dcd013fb75d9eabc6272dfb"
81+
checksum = "10e6b36237a9ca2ce2fb4cc7741d418a080afa1327402138412ef85d5367bef1"
8282
dependencies = [
8383
"cranelift-codegen-shared",
8484
]
8585

8686
[[package]]
8787
name = "cranelift-codegen-shared"
88-
version = "0.104.0"
88+
version = "0.105.2"
8989
source = "registry+https://github.com/rust-lang/crates.io-index"
90-
checksum = "4b031ec5e605828975952622b5a77d49126f20ffe88d33719a0af66b23a0fc36"
90+
checksum = "c36bf4bfb86898a94ccfa773a1f86e8a5346b1983ff72059bdd2db4600325251"
9191

9292
[[package]]
9393
name = "cranelift-control"
94-
version = "0.104.0"
94+
version = "0.105.2"
9595
source = "registry+https://github.com/rust-lang/crates.io-index"
96-
checksum = "fada054d017cf2ed8f7ed2336e0517fc1b19e6825be1790de9eb00c94788362b"
96+
checksum = "7cbf36560e7a6bd1409ca91e7b43b2cc7ed8429f343d7605eadf9046e8fac0d0"
9797
dependencies = [
9898
"arbitrary",
9999
]
100100

101101
[[package]]
102102
name = "cranelift-entity"
103-
version = "0.104.0"
103+
version = "0.105.2"
104104
source = "registry+https://github.com/rust-lang/crates.io-index"
105-
checksum = "177b6f94ae8de6348eb45bf977c79ab9e3c40fc3ac8cb7ed8109560ea39bee7d"
105+
checksum = "a71e11061a75b1184c09bea97c026a88f08b59ade96a7bb1f259d4ea0df2e942"
106106

107107
[[package]]
108108
name = "cranelift-frontend"
109-
version = "0.104.0"
109+
version = "0.105.2"
110110
source = "registry+https://github.com/rust-lang/crates.io-index"
111-
checksum = "ebebd23a69a23e3ddea78e98ff3a2de222e88c8e045d81ef4a72f042e0d79dbd"
111+
checksum = "af5d4da63143ee3485c7bcedde0a818727d737d1083484a0ceedb8950c89e495"
112112
dependencies = [
113113
"cranelift-codegen",
114114
"log",
@@ -118,15 +118,15 @@ dependencies = [
118118

119119
[[package]]
120120
name = "cranelift-isle"
121-
version = "0.104.0"
121+
version = "0.105.2"
122122
source = "registry+https://github.com/rust-lang/crates.io-index"
123-
checksum = "1571bfc14df8966d12c6121b5325026591a4b4009e22fea0fe3765ab7cd33b96"
123+
checksum = "457a9832b089e26f5eea70dcf49bed8ec6edafed630ce7c83161f24d46ab8085"
124124

125125
[[package]]
126126
name = "cranelift-jit"
127-
version = "0.104.0"
127+
version = "0.105.2"
128128
source = "registry+https://github.com/rust-lang/crates.io-index"
129-
checksum = "2f61e236d7622c3c43016e8b0f3ba27136e21ac7de328c7fda902e61db1de851"
129+
checksum = "0af95fe68d5a10919012c8db82b1d59820405b8001c8c6d05f94b08031334fa9"
130130
dependencies = [
131131
"anyhow",
132132
"cranelift-codegen",
@@ -144,9 +144,9 @@ dependencies = [
144144

145145
[[package]]
146146
name = "cranelift-module"
147-
version = "0.104.0"
147+
version = "0.105.2"
148148
source = "registry+https://github.com/rust-lang/crates.io-index"
149-
checksum = "f30c6820342015c5009070e3e48d1da7b13521399de904663f1c84f5ee839657"
149+
checksum = "11b0b201fa10a4014062d4c56c307c8d18fdf9a84cb5279efe6080241f42c7a7"
150150
dependencies = [
151151
"anyhow",
152152
"cranelift-codegen",
@@ -155,9 +155,9 @@ dependencies = [
155155

156156
[[package]]
157157
name = "cranelift-native"
158-
version = "0.104.0"
158+
version = "0.105.2"
159159
source = "registry+https://github.com/rust-lang/crates.io-index"
160-
checksum = "35a69c37e0c10b46fe5527f2397ac821046efbf5f7ec112c8b84df25712f465b"
160+
checksum = "9b490d579df1ce365e1ea359e24ed86d82289fa785153327c2f6a69a59a731e4"
161161
dependencies = [
162162
"cranelift-codegen",
163163
"libc",
@@ -166,9 +166,9 @@ dependencies = [
166166

167167
[[package]]
168168
name = "cranelift-object"
169-
version = "0.104.0"
169+
version = "0.105.2"
170170
source = "registry+https://github.com/rust-lang/crates.io-index"
171-
checksum = "24425a329b4343177d5f1852243841dcec17f929d72c0e7f41262140155e55e7"
171+
checksum = "fb7e821ac6db471bcdbd004e5a4fa0d374f1046bd3a2ce278c332e0b0c01ca63"
172172
dependencies = [
173173
"anyhow",
174174
"cranelift-codegen",
@@ -241,9 +241,9 @@ dependencies = [
241241

242242
[[package]]
243243
name = "libc"
244-
version = "0.2.148"
244+
version = "0.2.153"
245245
source = "registry+https://github.com/rust-lang/crates.io-index"
246-
checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b"
246+
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
247247

248248
[[package]]
249249
name = "libloading"
@@ -410,9 +410,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
410410

411411
[[package]]
412412
name = "wasmtime-jit-icache-coherence"
413-
version = "17.0.0"
413+
version = "18.0.2"
414414
source = "registry+https://github.com/rust-lang/crates.io-index"
415-
checksum = "bdc26415bb89e9ccd3bdc498fef63aabf665c4c0dd710c107691deb9694955da"
415+
checksum = "33f4121cb29dda08139b2824a734dd095d83ce843f2d613a84eb580b9cfc17ac"
416416
dependencies = [
417417
"cfg-if",
418418
"libc",

compiler/rustc_codegen_cranelift/Cargo.toml

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

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

compiler/rustc_codegen_cranelift/Readme.md

-5
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ You need to do this steps to successfully compile and use the cranelift backend
123123

124124
You can also set `rust-analyzer.rustc.source` to your rust workspace to get rust-analyzer to understand your changes.
125125

126-
## Configuration
127-
128-
See the documentation on the `BackendConfig` struct in [config.rs](src/config.rs) for all
129-
configuration options.
130-
131126
## Not yet supported
132127

133128
* SIMD ([tracked here](https://github.com/rust-lang/rustc_codegen_cranelift/issues/171), `std::simd` fully works, `std::arch` is partially supported)

compiler/rustc_codegen_cranelift/build_system/prepare.rs

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::ffi::OsStr;
22
use std::fs;
3+
use std::hash::{Hash, Hasher};
34
use std::path::{Path, PathBuf};
45
use std::process::Command;
56

@@ -71,7 +72,11 @@ fn hash_file(file: &std::path::Path) -> u64 {
7172
let contents = std::fs::read(file).unwrap();
7273
#[allow(deprecated)]
7374
let mut hasher = std::hash::SipHasher::new();
74-
std::hash::Hash::hash(&contents, &mut hasher);
75+
// The following is equivalent to
76+
// std::hash::Hash::hash(&contents, &mut hasher);
77+
// but gives the same result independent of host byte order.
78+
hasher.write_usize(contents.len().to_le());
79+
Hash::hash_slice(&contents, &mut hasher);
7580
std::hash::Hasher::finish(&hasher)
7681
}
7782

@@ -80,16 +85,26 @@ fn hash_dir(dir: &std::path::Path) -> u64 {
8085
for entry in std::fs::read_dir(dir).unwrap() {
8186
let entry = entry.unwrap();
8287
if entry.file_type().unwrap().is_dir() {
83-
sub_hashes
84-
.insert(entry.file_name().to_str().unwrap().to_owned(), hash_dir(&entry.path()));
88+
sub_hashes.insert(
89+
entry.file_name().to_str().unwrap().to_owned(),
90+
hash_dir(&entry.path()).to_le(),
91+
);
8592
} else {
86-
sub_hashes
87-
.insert(entry.file_name().to_str().unwrap().to_owned(), hash_file(&entry.path()));
93+
sub_hashes.insert(
94+
entry.file_name().to_str().unwrap().to_owned(),
95+
hash_file(&entry.path()).to_le(),
96+
);
8897
}
8998
}
9099
#[allow(deprecated)]
91100
let mut hasher = std::hash::SipHasher::new();
92-
std::hash::Hash::hash(&sub_hashes, &mut hasher);
101+
// The following is equivalent to
102+
// std::hash::Hash::hash(&sub_hashes, &mut hasher);
103+
// but gives the same result independent of host byte order.
104+
hasher.write_usize(sub_hashes.len().to_le());
105+
for elt in sub_hashes {
106+
elt.hash(&mut hasher);
107+
}
93108
std::hash::Hasher::finish(&hasher)
94109
}
95110

compiler/rustc_codegen_cranelift/build_system/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ pub(crate) static REGEX: CargoProject = CargoProject::new(&REGEX_REPO.source_dir
133133
pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
134134
"rust-lang",
135135
"portable-simd",
136-
"97007cc2e70df8c97326ce896a79e2f0ce4dd98b",
137-
"e54a16035cedf205",
136+
"5794c837bc605c4cd9dbb884285976dfdb293cce",
137+
"a64d8fdd0ed0d9c4",
138138
"portable-simd",
139139
);
140140

compiler/rustc_codegen_cranelift/patches/0022-coretests-Disable-not-compiling-tests.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ index 42a26ae..5ac1042 100644
3939
+#![cfg(test)]
4040
#![feature(alloc_layout_extra)]
4141
#![feature(array_chunks)]
42-
#![feature(array_methods)]
42+
#![feature(array_windows)]
4343
--
4444
2.21.0 (Apple Git-122)

compiler/rustc_codegen_cranelift/patches/0023-coretests-Ignore-failing-tests.patch

-26
This file was deleted.

compiler/rustc_codegen_cranelift/patches/stdlib-lock.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ dependencies = [
150150

151151
[[package]]
152152
name = "hermit-abi"
153-
version = "0.3.3"
153+
version = "0.3.9"
154154
source = "registry+https://github.com/rust-lang/crates.io-index"
155-
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
155+
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
156156
dependencies = [
157157
"compiler_builtins",
158158
"rustc-std-workspace-alloc",
@@ -161,9 +161,9 @@ dependencies = [
161161

162162
[[package]]
163163
name = "libc"
164-
version = "0.2.150"
164+
version = "0.2.153"
165165
source = "registry+https://github.com/rust-lang/crates.io-index"
166-
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
166+
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
167167
dependencies = [
168168
"rustc-std-workspace-core",
169169
]
@@ -398,6 +398,7 @@ version = "0.0.0"
398398
dependencies = [
399399
"core",
400400
"getopts",
401+
"libc",
401402
"panic_abort",
402403
"panic_unwind",
403404
"std",
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-01-26"
2+
channel = "nightly-2024-03-08"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]

compiler/rustc_codegen_cranelift/rustfmt.toml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
ignore = [
2-
"y.rs",
32
"example/gen_block_iterate.rs", # uses edition 2024
43
]
54

0 commit comments

Comments
 (0)