Skip to content

Commit 4ea92e3

Browse files
committed
Auto merge of #123166 - bjorn3:sync_cg_clif-2024-03-28, r=bjorn3
Subtree sync for rustc_codegen_cranelift The main highlight this time is debuginfo for statics. Not all types are supported yet. Those that aren't supported are represented as `[u8; mem::size_of::<T>()]` instead. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2 parents 551abd6 + 987ed34 commit 4ea92e3

24 files changed

+841
-292
lines changed

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.105.2"
49+
version = "0.106.0"
5050
source = "registry+https://github.com/rust-lang/crates.io-index"
51-
checksum = "9515fcc42b6cb5137f76b84c1a6f819782d0cf12473d145d3bc5cd67eedc8bc2"
51+
checksum = "6a535eb1cf5a6003197dc569320c40c1cb2d2f97ef5d5348eebf067f20957381"
5252
dependencies = [
5353
"cranelift-entity",
5454
]
5555

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

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

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

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

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

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

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

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

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

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

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

393393
[[package]]
394394
name = "target-lexicon"
395-
version = "0.12.12"
395+
version = "0.12.14"
396396
source = "registry+https://github.com/rust-lang/crates.io-index"
397-
checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
397+
checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
398398

399399
[[package]]
400400
name = "unicode-ident"
@@ -410,9 +410,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
410410

411411
[[package]]
412412
name = "wasmtime-jit-icache-coherence"
413-
version = "18.0.2"
413+
version = "19.0.0"
414414
source = "registry+https://github.com/rust-lang/crates.io-index"
415-
checksum = "33f4121cb29dda08139b2824a734dd095d83ce843f2d613a84eb580b9cfc17ac"
415+
checksum = "2796e4b4989db62899d2117e1e0258b839d088c044591b14e3a0396e7b3ae53a"
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.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" }
11+
cranelift-codegen = { version = "0.106.0", default-features = false, features = ["std", "unwind", "all-arch"] }
12+
cranelift-frontend = { version = "0.106.0" }
13+
cranelift-module = { version = "0.106.0" }
14+
cranelift-native = { version = "0.106.0" }
15+
cranelift-jit = { version = "0.106.0", optional = true }
16+
cranelift-object = { version = "0.106.0" }
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/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_windows)]
42+
#![feature(array_ptr_get)]
4343
--
4444
2.21.0 (Apple Git-122)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-03-16"
2+
channel = "nightly-2024-03-28"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]

compiler/rustc_codegen_cranelift/scripts/rustc-clif.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ fn main() {
2626
codegen_backend_arg.push(cg_clif_dylib_path);
2727
args.push(codegen_backend_arg);
2828
}
29-
if !passed_args.iter().any(|arg| {
30-
arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))
31-
}) {
29+
if !passed_args
30+
.iter()
31+
.any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")))
32+
{
3233
args.push(OsString::from("--sysroot"));
3334
args.push(OsString::from(sysroot.to_str().unwrap()));
3435
}

compiler/rustc_codegen_cranelift/scripts/rustdoc-clif.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ fn main() {
2626
codegen_backend_arg.push(cg_clif_dylib_path);
2727
args.push(codegen_backend_arg);
2828
}
29-
if !passed_args.iter().any(|arg| {
30-
arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot="))
31-
}) {
29+
if !passed_args
30+
.iter()
31+
.any(|arg| arg == "--sysroot" || arg.to_str().is_some_and(|s| s.starts_with("--sysroot=")))
32+
{
3233
args.push(OsString::from("--sysroot"));
3334
args.push(OsString::from(sysroot.to_str().unwrap()));
3435
}
36+
if passed_args.is_empty() {
37+
// Don't pass any arguments when the user didn't pass any arguments
38+
// either to ensure the help message is shown.
39+
args.clear();
40+
}
3541
args.extend(passed_args);
3642

3743
let rustdoc = if let Some(rustdoc) = option_env!("RUSTDOC") {

compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh

+26-28
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ pushd rust
1010

1111
command -v rg >/dev/null 2>&1 || cargo install ripgrep
1212

13-
# FIXME(rust-lang/rust#122196) fix stage0 rmake.rs run-make tests and remove
14-
# this workaround
15-
for test in $(ls tests/run-make); do
16-
if [[ -e "tests/run-make/$test/rmake.rs" ]]; then
17-
rm -r "tests/run-make/$test"
18-
fi
19-
done
20-
2113
# FIXME remove this workaround once ICE tests no longer emit an outdated nightly message
2214
for test in $(rg -i --files-with-matches "//@(\[.*\])? failure-status: 101" tests/ui); do
2315
echo "rm $test"
@@ -42,7 +34,6 @@ rm tests/ui/parser/unclosed-delimiter-in-dep.rs # submodule contains //~ERROR
4234
# ================
4335

4436
# vendor intrinsics
45-
rm tests/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant"
4637
rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic
4738

4839
# exotic linkages
@@ -59,12 +50,9 @@ rm -r tests/run-make/c-link-to-rust-va-list-fn # requires callee side vararg sup
5950
rm -r tests/run-pass-valgrind/unsized-locals
6051

6152
# misc unimplemented things
62-
rm tests/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics
6353
rm tests/ui/target-feature/missing-plusminus.rs # error not implemented
64-
rm -r tests/run-make/emit-named-files # requires full --emit support
6554
rm -r tests/run-make/repr128-dwarf # debuginfo test
6655
rm -r tests/run-make/split-debuginfo # same
67-
rm -r tests/run-make/symbols-include-type-name # --emit=asm not supported
6856
rm -r tests/run-make/target-specs # i686 not supported by Cranelift
6957
rm -r tests/run-make/mismatching-target-triples # same
7058
rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly
@@ -102,42 +90,39 @@ rm tests/ui/abi/stack-protector.rs # requires stack protector support
10290
rm -r tests/run-make/emit-stack-sizes # requires support for -Z emit-stack-sizes
10391
rm -r tests/run-make/optimization-remarks-dir # remarks are LLVM specific
10492

93+
# requires asm, llvm-ir and/or llvm-bc emit support
94+
# =============================================
95+
rm -r tests/run-make/emit-named-files
96+
rm -r tests/run-make/issue-30063
97+
rm -r tests/run-make/multiple-emits
98+
rm -r tests/run-make/output-type-permutations
99+
rm -r tests/run-make/emit-to-stdout
100+
rm -r tests/run-make/compressed-debuginfo
101+
rm -r tests/run-make/symbols-include-type-name
102+
103+
105104
# giving different but possibly correct results
106105
# =============================================
107106
rm tests/ui/mir/mir_misc_casts.rs # depends on deduplication of constants
108107
rm tests/ui/mir/mir_raw_fat_ptr.rs # same
109108
rm tests/ui/consts/issue-33537.rs # same
110109
rm tests/ui/consts/const-mut-refs-crate.rs # same
111110

112-
# rustdoc-clif passes extra args, suppressing the help message when no args are passed
113-
rm -r tests/run-make/issue-88756-default-output
114-
115111
# doesn't work due to the way the rustc test suite is invoked.
116112
# should work when using ./x.py test the way it is intended
117113
# ============================================================
118114
rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump
115+
rm -r tests/run-make/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source
119116

120117
# genuine bugs
121118
# ============
122119
rm tests/incremental/spike-neg1.rs # errors out for some reason
123120
rm tests/incremental/spike-neg2.rs # same
124-
125-
rm -r tests/run-make/issue-51671 # wrong filename given in case of --emit=obj
126-
rm -r tests/run-make/issue-30063 # same
127-
rm -r tests/run-make/multiple-emits # same
128-
rm -r tests/run-make/output-type-permutations # same
129-
rm -r tests/run-make/used # same
130-
rm -r tests/run-make/no-alloc-shim
131-
rm -r tests/run-make/emit-to-stdout
132-
rm -r tests/run-make/compressed-debuginfo
133-
134121
rm -r tests/run-make/extern-fn-explicit-align # argument alignment not yet supported
135-
136-
rm tests/ui/codegen/subtyping-enforces-type-equality.rs # assert_assignable bug with Coroutine's
122+
rm -r tests/run-make/panic-abort-eh_frame # .eh_frame emitted with panic=abort
137123

138124
# bugs in the test suite
139125
# ======================
140-
rm tests/ui/backtrace.rs # TODO warning
141126
rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue
142127

143128
rm tests/ui/stdio-is-blocking.rs # really slow with unoptimized libstd
@@ -160,6 +145,19 @@ index ea06b620c4c..b969d0009c6 100644
160145
ifdef RUSTC_LINKER
161146
RUSTC := \$(RUSTC) -Clinker='\$(RUSTC_LINKER)'
162147
RUSTDOC := \$(RUSTDOC) -Clinker='\$(RUSTC_LINKER)'
148+
diff --git a/src/tools/run-make-support/src/rustdoc.rs b/src/tools/run-make-support/src/rustdoc.rs
149+
index 9607ff02f96..b7d97caf9a2 100644
150+
--- a/src/tools/run-make-support/src/rustdoc.rs
151+
+++ b/src/tools/run-make-support/src/rustdoc.rs
152+
@@ -34,8 +34,6 @@ pub fn bare() -> Self {
153+
/// Construct a \`rustdoc\` invocation with \`-L \$(TARGET_RPATH_DIR)\` set.
154+
pub fn new() -> Self {
155+
let mut cmd = setup_common();
156+
- let target_rpath_dir = env::var_os("TARGET_RPATH_DIR").unwrap();
157+
- cmd.arg(format!("-L{}", target_rpath_dir.to_string_lossy()));
158+
Self { cmd }
159+
}
160+
163161
EOF
164162

165163
echo "[TEST] rustc test suite"

compiler/rustc_codegen_cranelift/src/abi/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,15 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
222222
Spread(Vec<Option<CValue<'tcx>>>),
223223
}
224224

225-
let fn_abi = fx.fn_abi.take().unwrap();
226-
227225
// FIXME implement variadics in cranelift
228-
if fn_abi.c_variadic {
226+
if fx.fn_abi.c_variadic {
229227
fx.tcx.dcx().span_fatal(
230228
fx.mir.span,
231229
"Defining variadic functions is not yet supported by Cranelift",
232230
);
233231
}
234232

235-
let mut arg_abis_iter = fn_abi.args.iter();
233+
let mut arg_abis_iter = fx.fn_abi.args.iter();
236234

237235
let func_params = fx
238236
.mir
@@ -279,7 +277,6 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
279277
}
280278

281279
assert!(arg_abis_iter.next().is_none(), "ArgAbi left behind");
282-
fx.fn_abi = Some(fn_abi);
283280
assert!(block_params_iter.next().is_none(), "arg_value left behind");
284281

285282
self::comments::add_locals_header_comment(fx);

0 commit comments

Comments
 (0)