Skip to content

Commit ec19410

Browse files
committed
Merge branch 'master' into sync_from_rust_2025_08_14
2 parents 708742f + 2714314 commit ec19410

File tree

14 files changed

+94
-89
lines changed

14 files changed

+94
-89
lines changed

.github/workflows/m68k.yml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ jobs:
9191
./y.sh prepare --only-libcore --cross
9292
./y.sh build --sysroot --features compiler-builtins-no-f16-f128 --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 --sysroot-features compiler-builtins-no-f16-f128 ${{ 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!

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
]

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.

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
}

example/mini_core_hello_world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)]
77
#![no_core]
88
#![allow(dead_code, internal_features, non_camel_case_types)]
9-
#![rustfmt_skip]
9+
#![cfg_attr(rustfmt, rustfmt_skip)]
1010

1111
extern crate mini_core;
1212

libgccjit.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
04ce66d8c918de9273bd7101638ad8724edf5e21
1+
4e995bd73c4490edfe5080ec6014d63aa9abed5f

src/archive.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use std::path::Path;
2+
3+
use rustc_codegen_ssa::back::archive::{
4+
ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
5+
};
6+
use rustc_session::Session;
7+
8+
pub(crate) struct ArArchiveBuilderBuilder;
9+
10+
impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
11+
fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box<dyn ArchiveBuilder + 'a> {
12+
Box::new(ArArchiveBuilder::new(sess, &DEFAULT_OBJECT_READER))
13+
}
14+
15+
fn create_dll_import_lib(
16+
&self,
17+
_sess: &Session,
18+
_lib_name: &str,
19+
_import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,
20+
_output_path: &Path,
21+
) {
22+
unimplemented!("creating dll imports is not yet supported");
23+
}
24+
}

src/intrinsic/mod.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -74,44 +74,8 @@ fn get_simple_intrinsic<'gcc, 'tcx>(
7474
sym::fabsf64 => "fabs",
7575
sym::minnumf32 => "fminf",
7676
sym::minnumf64 => "fmin",
77-
sym::minimumf32 => "fminimumf",
78-
sym::minimumf64 => "fminimum",
79-
sym::minimumf128 => {
80-
// GCC doesn't have the intrinsic we want so we use the compiler-builtins one
81-
// https://docs.rs/compiler_builtins/latest/compiler_builtins/math/full_availability/fn.fminimumf128.html
82-
let f128_type = cx.type_f128();
83-
return Some(cx.context.new_function(
84-
None,
85-
FunctionType::Extern,
86-
f128_type,
87-
&[
88-
cx.context.new_parameter(None, f128_type, "a"),
89-
cx.context.new_parameter(None, f128_type, "b"),
90-
],
91-
"fminimumf128",
92-
false,
93-
));
94-
}
9577
sym::maxnumf32 => "fmaxf",
9678
sym::maxnumf64 => "fmax",
97-
sym::maximumf32 => "fmaximumf",
98-
sym::maximumf64 => "fmaximum",
99-
sym::maximumf128 => {
100-
// GCC doesn't have the intrinsic we want so we use the compiler-builtins one
101-
// https://docs.rs/compiler_builtins/latest/compiler_builtins/math/full_availability/fn.fmaximumf128.html
102-
let f128_type = cx.type_f128();
103-
return Some(cx.context.new_function(
104-
None,
105-
FunctionType::Extern,
106-
f128_type,
107-
&[
108-
cx.context.new_parameter(None, f128_type, "a"),
109-
cx.context.new_parameter(None, f128_type, "b"),
110-
],
111-
"fmaximumf128",
112-
false,
113-
));
114-
}
11579
sym::copysignf32 => "copysignf",
11680
sym::copysignf64 => "copysign",
11781
sym::floorf32 => "floorf",

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);

tests/run/int.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ fn main() {
77
use std::hint::black_box;
88

99
macro_rules! check {
10-
($ty:ty, $expr:expr) => {
11-
{
12-
const EXPECTED: $ty = $expr;
13-
assert_eq!($expr, EXPECTED);
14-
}
15-
};
10+
($ty:ty, $expr:expr) => {{
11+
const EXPECTED: $ty = $expr;
12+
assert_eq!($expr, EXPECTED);
13+
}};
1614
}
1715

1816
check!(u32, (2220326408_u32 + black_box(1)) >> (32 - 6));

0 commit comments

Comments
 (0)