Skip to content

Commit 160e762

Browse files
committed
Auto merge of #145890 - GuillaumeGomez:subtree-update_cg_gcc_2025-08-26, r=GuillaumeGomez
GCC backend subtree update cc `@antoyo` r? ghost
2 parents 91ee6a4 + 92104a6 commit 160e762

File tree

16 files changed

+77
-61
lines changed

16 files changed

+77
-61
lines changed

compiler/rustc_codegen_gcc/.github/workflows/m68k.yml

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,16 @@ jobs:
8282
- name: Build sample project with target defined as JSON spec
8383
run: |
8484
./y.sh prepare --only-libcore --cross
85-
./y.sh build --sysroot --features compiler-builtins-no-f16-f128 --target-triple m68k-unknown-linux-gnu --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
85+
./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
8686
CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ./y.sh cargo build --manifest-path=./tests/hello-world/Cargo.toml --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
8787
./y.sh clean all
8888
8989
- name: Build
9090
run: |
9191
./y.sh prepare --only-libcore --cross
92-
./y.sh build --sysroot --features compiler-builtins-no-f16-f128 --target-triple m68k-unknown-linux-gnu
92+
./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu
9393
./y.sh test --mini-tests --target-triple m68k-unknown-linux-gnu
94-
# FIXME: since https://github.com/rust-lang/rust/pull/140809, we cannot run programs for architectures not
95-
# supported by the object crate, since this adds a dependency on symbols.o for the panic runtime.
96-
# And as such, a wrong order of the object files in the linker command now fails with an undefined reference
97-
# to some symbols like __rustc::rust_panic.
98-
#CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests --target-triple m68k-unknown-linux-gnu
94+
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests --target-triple m68k-unknown-linux-gnu
9995
./y.sh clean all
10096
10197
- name: Prepare dependencies
@@ -104,23 +100,21 @@ jobs:
104100
git config --global user.name "User"
105101
./y.sh prepare --cross
106102
107-
# FIXME: We cannot run programs for architectures not supported by the object crate. See comment above.
108-
#- name: Run tests
109-
#run: |
110-
#./y.sh test --target-triple m68k-unknown-linux-gnu --release --clean --build-sysroot --sysroot-features compiler-builtins-no-f16-f128 ${{ matrix.commands }}
111-
112-
# FIXME: We cannot run programs for architectures not supported by the object crate. See comment above.
113-
#- name: Run Hello World!
114-
#run: |
115-
#./y.sh build --target-triple m68k-unknown-linux-gnu
116-
117-
#vm_dir=$(pwd)/vm
118-
#cd tests/hello-world
119-
#CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ../../y.sh cargo build --target m68k-unknown-linux-gnu
120-
#sudo cp target/m68k-unknown-linux-gnu/debug/hello_world $vm_dir/home/
121-
#sudo chroot $vm_dir qemu-m68k-static /home/hello_world > hello_world_stdout
122-
#expected_output="40"
123-
#test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)
103+
- name: Run tests
104+
run: |
105+
./y.sh test --target-triple m68k-unknown-linux-gnu --release --clean --build-sysroot ${{ matrix.commands }}
106+
107+
- name: Run Hello World!
108+
run: |
109+
./y.sh build --target-triple m68k-unknown-linux-gnu
110+
111+
vm_dir=$(pwd)/vm
112+
cd tests/hello-world
113+
CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ../../y.sh cargo build --target m68k-unknown-linux-gnu
114+
sudo cp target/m68k-unknown-linux-gnu/debug/hello_world $vm_dir/home/
115+
sudo chroot $vm_dir qemu-m68k-static /home/hello_world > hello_world_stdout
116+
expected_output="40"
117+
test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)
124118
125119
# Summary job for the merge queue.
126120
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

compiler/rustc_codegen_gcc/Cargo.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ dependencies = [
5656

5757
[[package]]
5858
name = "gccjit"
59-
version = "2.7.0"
59+
version = "2.9.0"
6060
source = "registry+https://github.com/rust-lang/crates.io-index"
61-
checksum = "ae99a89184220d967dd300139f2d2ae7d52c1a69d632b24aacc57c54625254ce"
61+
checksum = "4a0e310ef75f396cd11b2443b353d55376656ca92c13cba36f92b7aff346ac1a"
6262
dependencies = [
6363
"gccjit_sys",
6464
]
6565

6666
[[package]]
6767
name = "gccjit_sys"
68-
version = "0.8.0"
68+
version = "0.8.2"
6969
source = "registry+https://github.com/rust-lang/crates.io-index"
70-
checksum = "24edb7bfe2b7b27c6d09ed23eebfcab0b359c8fe978433f902943e6f127a0f1b"
70+
checksum = "95ed7572b30cd32430294dde6fb70822d58e67c6846a548647e8739776a0125b"
7171
dependencies = [
7272
"libc",
7373
]

compiler/rustc_codegen_gcc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ default = ["master"]
2424
[dependencies]
2525
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
2626
tempfile = "3.20"
27-
gccjit = "2.7"
27+
gccjit = "2.8"
2828
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs" }
2929

3030
# Local copy.

compiler/rustc_codegen_gcc/build_system/src/fmt.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::ffi::OsStr;
22
use std::path::Path;
33

4-
use crate::utils::run_command_with_output;
4+
use crate::utils::{run_command_with_output, walk_dir};
55

66
fn show_usage() {
77
println!(
@@ -32,5 +32,31 @@ pub fn run() -> Result<(), String> {
3232
if check { &[&"cargo", &"fmt", &"--check"] } else { &[&"cargo", &"fmt"] };
3333

3434
run_command_with_output(cmd, Some(Path::new(".")))?;
35-
run_command_with_output(cmd, Some(Path::new("build_system")))
35+
run_command_with_output(cmd, Some(Path::new("build_system")))?;
36+
37+
run_rustfmt_recursively("tests/run", check)
38+
}
39+
40+
fn run_rustfmt_recursively<P>(dir: P, check: bool) -> Result<(), String>
41+
where
42+
P: AsRef<Path>,
43+
{
44+
walk_dir(
45+
dir,
46+
&mut |dir| run_rustfmt_recursively(dir, check),
47+
&mut |file_path| {
48+
if file_path.extension().filter(|ext| ext == &OsStr::new("rs")).is_some() {
49+
let rustfmt_cmd: &[&dyn AsRef<OsStr>] = if check {
50+
&[&"rustfmt", &"--check", &file_path]
51+
} else {
52+
&[&"rustfmt", &file_path]
53+
};
54+
55+
run_command_with_output(rustfmt_cmd, Some(Path::new(".")))
56+
} else {
57+
Ok(())
58+
}
59+
},
60+
true,
61+
)
3662
}

compiler/rustc_codegen_gcc/build_system/src/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
531531
r#"change-id = 115898
532532
533533
[rust]
534-
codegen-backends = []
534+
codegen-backends = ["gcc"]
535535
deny-warnings = false
536536
verbose-tests = true
537537
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
04ce66d8c918de9273bd7101638ad8724edf5e21
1+
4e995bd73c4490edfe5080ec6014d63aa9abed5f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2025-08-03"
2+
channel = "nightly-2025-08-25"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

compiler/rustc_codegen_gcc/src/intrinsic/simd.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,6 @@ fn simd_funnel_shift<'a, 'gcc, 'tcx>(
14971497
let index = bx.context.new_rvalue_from_int(bx.int_type, i as i32);
14981498
let a_val = bx.context.new_vector_access(None, a, index).to_rvalue();
14991499
let a_val = bx.context.new_bitcast(None, a_val, unsigned_type);
1500-
// TODO: we probably need to use gcc_int_cast instead.
15011500
let a_val = bx.gcc_int_cast(a_val, new_int_type);
15021501
let b_val = bx.context.new_vector_access(None, b, index).to_rvalue();
15031502
let b_val = bx.context.new_bitcast(None, b_val, unsigned_type);

compiler/rustc_codegen_gcc/tests/failing-run-make-tests.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ tests/run-make/doctests-keep-binaries/
66
tests/run-make/doctests-runtool/
77
tests/run-make/emit-shared-files/
88
tests/run-make/exit-code/
9-
tests/run-make/issue-64153/
109
tests/run-make/llvm-ident/
1110
tests/run-make/native-link-modifier-bundle/
1211
tests/run-make/remap-path-prefix-dwarf/
@@ -34,8 +33,6 @@ tests/run-make/c-link-to-rust-staticlib/
3433
tests/run-make/foreign-double-unwind/
3534
tests/run-make/foreign-exceptions/
3635
tests/run-make/glibc-staticlib-args/
37-
tests/run-make/issue-36710/
38-
tests/run-make/issue-68794-textrel-on-minimal-lib/
3936
tests/run-make/lto-smoke-c/
4037
tests/run-make/return-non-c-like-enum/
4138

compiler/rustc_codegen_gcc/tests/failing-ui-tests.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tests/ui/drop/dynamic-drop.rs
2020
tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs
2121
tests/ui/simd/issue-17170.rs
2222
tests/ui/simd/issue-39720.rs
23-
tests/ui/issues/issue-14875.rs
23+
tests/ui/drop/panic-during-drop-14875.rs
2424
tests/ui/issues/issue-29948.rs
2525
tests/ui/process/println-with-broken-pipe.rs
2626
tests/ui/lto/thin-lto-inlines2.rs
@@ -86,3 +86,5 @@ tests/ui/panics/unwind-force-no-unwind-tables.rs
8686
tests/ui/attributes/fn-align-dyn.rs
8787
tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs
8888
tests/ui/explicit-tail-calls/recursion-etc.rs
89+
tests/ui/explicit-tail-calls/indexer.rs
90+
tests/ui/explicit-tail-calls/drop-order.rs

0 commit comments

Comments
 (0)