Skip to content

Commit a760954

Browse files
authored
Rollup merge of #124286 - bjorn3:sync_cg_clif-2024-04-23, r=bjorn3
Subtree sync for rustc_codegen_cranelift This fixes a crash when compiling the standard library. In addition the Cranelift update fixes all the 128bit int abi incompatibility between cg_clif and cg_llvm. r? ``@ghost`` ``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2 parents afb6c46 + 96152c7 commit a760954

24 files changed

+190
-212
lines changed

compiler/rustc_codegen_cranelift/Cargo.lock

Lines changed: 90 additions & 149 deletions
Large diffs are not rendered by default.

compiler/rustc_codegen_cranelift/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ crate-type = ["dylib"]
88

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

2121
indexmap = "2.0.0"
2222
libloading = { version = "0.8.0", optional = true }

compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ pub(crate) fn run(
4343
let mut cmd = ABI_CAFE.run(bootstrap_host_compiler, dirs);
4444
cmd.arg("--");
4545
cmd.arg("--pairs");
46-
cmd.args(pairs);
46+
cmd.args(
47+
if cfg!(not(any(target_os = "macos", all(target_os = "windows", target_env = "msvc")))) {
48+
&pairs[..]
49+
} else {
50+
&pairs[..2]
51+
},
52+
);
4753
cmd.arg("--add-rustc-codegen-backend");
4854
match cg_clif_dylib {
4955
CodegenBackend::Local(path) => {

compiler/rustc_codegen_cranelift/build_system/tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub(crate) fn run_tests(
290290
&& !skip_tests.contains(&"testsuite.extended_sysroot");
291291

292292
if run_base_sysroot || run_extended_sysroot {
293-
let mut target_compiler = build_sysroot::build_sysroot(
293+
let target_compiler = build_sysroot::build_sysroot(
294294
dirs,
295295
channel,
296296
sysroot_kind,
@@ -299,11 +299,8 @@ pub(crate) fn run_tests(
299299
rustup_toolchain_name,
300300
target_triple.clone(),
301301
);
302-
// Rust's build system denies a couple of lints that trigger on several of the test
303-
// projects. Changing the code to fix them is not worth it, so just silence all lints.
304-
target_compiler.rustflags.push("--cap-lints=allow".to_owned());
305302

306-
let runner = TestRunner::new(
303+
let mut runner = TestRunner::new(
307304
dirs.clone(),
308305
target_compiler,
309306
use_unstable_features,
@@ -319,6 +316,9 @@ pub(crate) fn run_tests(
319316
}
320317

321318
if run_extended_sysroot {
319+
// Rust's build system denies a couple of lints that trigger on several of the test
320+
// projects. Changing the code to fix them is not worth it, so just silence all lints.
321+
runner.target_compiler.rustflags.push("--cap-lints=allow".to_owned());
322322
runner.run_testsuite(EXTENDED_SYSROOT_SUITE);
323323
} else {
324324
eprintln!("[SKIP] extended_sysroot tests");

compiler/rustc_codegen_cranelift/example/alloc_example.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(start, core_intrinsics, alloc_error_handler, lang_items)]
2+
#![allow(internal_features)]
23
#![no_std]
34

45
extern crate alloc;

compiler/rustc_codegen_cranelift/example/alloc_system.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ mod platform {
8080
extern "system" {
8181
fn GetProcessHeap() -> HANDLE;
8282
fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID;
83-
fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID, dwBytes: SIZE_T) -> LPVOID;
8483
fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
8584
fn GetLastError() -> DWORD;
8685
}
@@ -111,7 +110,7 @@ mod platform {
111110
allocate_with_flags(layout, HEAP_ZERO_MEMORY)
112111
}
113112
#[inline]
114-
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
113+
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
115114
let header = get_header(ptr);
116115
let err = HeapFree(GetProcessHeap(), 0, header.0 as LPVOID);
117116
debug_assert!(err != 0, "Failed to free heap memory: {}", GetLastError());

compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Test that the simd_f{min,max} intrinsics produce the correct results.
66

77
#![feature(repr_simd, core_intrinsics)]
8-
#![allow(non_camel_case_types)]
8+
#![allow(internal_features, non_camel_case_types)]
99

1010
#[repr(simd)]
1111
#[derive(Copy, Clone, PartialEq, Debug)]

compiler/rustc_codegen_cranelift/example/mod_bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(start, core_intrinsics, lang_items)]
2+
#![allow(internal_features)]
23
#![no_std]
34

45
#[cfg_attr(unix, link(name = "c"))]

compiler/rustc_codegen_cranelift/example/neon.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
#[cfg(target_arch = "aarch64")]
66
use std::arch::aarch64::*;
7+
#[cfg(target_arch = "aarch64")]
78
use std::mem::transmute;
9+
#[cfg(target_arch = "aarch64")]
810
use std::simd::*;
911

1012
#[cfg(target_arch = "aarch64")]

compiler/rustc_codegen_cranelift/example/std_example.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
tuple_trait,
88
unboxed_closures
99
)]
10+
#![allow(internal_features)]
1011

1112
#[cfg(target_arch = "x86_64")]
1213
use std::arch::x86_64::*;

0 commit comments

Comments
 (0)