Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
84f834b
atomicrmw on pointers: move integer-pointer cast hacks into backend
RalfJung Jul 19, 2025
c4b91bd
Merge commit '482e8540a1b757ed7bccc2041c5400f051fdb01e' into subtree-…
GuillaumeGomez Aug 4, 2025
1c79360
Reenable m68k CI
antoyo Aug 4, 2025
aa51e18
Remove outdated comment
antoyo Aug 4, 2025
f0ab82f
Merge pull request #373 from rust-lang/fix/m68k
antoyo Aug 4, 2025
2136c50
Preserve the .debug_gdb_scripts section
sebastianpoeplau Aug 1, 2025
82aac02
Revert "Preserve the .debug_gdb_scripts section"
bjorn3 Aug 6, 2025
098d06b
Prevent name collisions with internal implementation details
bjorn3 Aug 7, 2025
e22a140
Update gccjit dependency and libgccjit commit
GuillaumeGomez Aug 8, 2025
708742f
Rollup merge of #144192 - RalfJung:atomicrmw-ptr, r=nikic
tgross35 Aug 8, 2025
307ebca
run rustfmt on tests/run/*.rs
dvermd Aug 10, 2025
dde77db
fix tests/run formatting
dvermd Aug 10, 2025
32db0c6
Merge pull request #748 from dvermd/fmt_tests_run
antoyo Aug 13, 2025
27beb72
Port the `#[linkage]` attribute to the new attribute system
scrabsha Aug 12, 2025
2714314
Merge pull request #747 from GuillaumeGomez/update
antoyo Aug 13, 2025
ec19410
Merge branch 'master' into sync_from_rust_2025_08_14
antoyo Aug 14, 2025
26183d5
Update to nightly-2025-08-14
antoyo Aug 14, 2025
3f476d3
Rename/remove some UI and run-make tests
antoyo Aug 14, 2025
eff47b5
Don't set feature compiler-builtins-no-f16-f128
antoyo Aug 14, 2025
e6eb521
Complete functionality and general cleanup
Sa4dUs Aug 14, 2025
aac150e
Merge pull request #751 from rust-lang/sync_from_rust_2025_08_14
antoyo Aug 14, 2025
02a3cae
Merge branch 'master' into sync_from_rust_2025_08_25
antoyo Aug 25, 2025
a53663f
Update to nightly-2025-08-25
antoyo Aug 25, 2025
ad99858
Set default codegen backend to gcc
antoyo Aug 25, 2025
feb4282
Merge pull request #753 from rust-lang/sync_from_rust_2025_08_25
antoyo Aug 25, 2025
1713713
Merge commit 'feb42827f11a7ae241ceecc81e9ae556fb6ba214' into subtree-…
GuillaumeGomez Aug 26, 2025
a03a0f1
Fix sync conflict
GuillaumeGomez Aug 26, 2025
92104a6
Update GCC submodule
GuillaumeGomez Aug 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions compiler/rustc_codegen_gcc/.github/workflows/m68k.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,16 @@ jobs:
- name: Build sample project with target defined as JSON spec
run: |
./y.sh prepare --only-libcore --cross
./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
./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
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
./y.sh clean all

- name: Build
run: |
./y.sh prepare --only-libcore --cross
./y.sh build --sysroot --features compiler-builtins-no-f16-f128 --target-triple m68k-unknown-linux-gnu
./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu
./y.sh test --mini-tests --target-triple m68k-unknown-linux-gnu
# FIXME: since https://github.com/rust-lang/rust/pull/140809, we cannot run programs for architectures not
# supported by the object crate, since this adds a dependency on symbols.o for the panic runtime.
# And as such, a wrong order of the object files in the linker command now fails with an undefined reference
# to some symbols like __rustc::rust_panic.
#CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests --target-triple m68k-unknown-linux-gnu
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests --target-triple m68k-unknown-linux-gnu
./y.sh clean all

- name: Prepare dependencies
Expand All @@ -104,23 +100,21 @@ jobs:
git config --global user.name "User"
./y.sh prepare --cross

# FIXME: We cannot run programs for architectures not supported by the object crate. See comment above.
#- name: Run tests
#run: |
#./y.sh test --target-triple m68k-unknown-linux-gnu --release --clean --build-sysroot --sysroot-features compiler-builtins-no-f16-f128 ${{ matrix.commands }}

# FIXME: We cannot run programs for architectures not supported by the object crate. See comment above.
#- name: Run Hello World!
#run: |
#./y.sh build --target-triple m68k-unknown-linux-gnu

#vm_dir=$(pwd)/vm
#cd tests/hello-world
#CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ../../y.sh cargo build --target m68k-unknown-linux-gnu
#sudo cp target/m68k-unknown-linux-gnu/debug/hello_world $vm_dir/home/
#sudo chroot $vm_dir qemu-m68k-static /home/hello_world > hello_world_stdout
#expected_output="40"
#test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)
- name: Run tests
run: |
./y.sh test --target-triple m68k-unknown-linux-gnu --release --clean --build-sysroot ${{ matrix.commands }}

- name: Run Hello World!
run: |
./y.sh build --target-triple m68k-unknown-linux-gnu

vm_dir=$(pwd)/vm
cd tests/hello-world
CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ../../y.sh cargo build --target m68k-unknown-linux-gnu
sudo cp target/m68k-unknown-linux-gnu/debug/hello_world $vm_dir/home/
sudo chroot $vm_dir qemu-m68k-static /home/hello_world > hello_world_stdout
expected_output="40"
test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)

# Summary job for the merge queue.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_gcc/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ dependencies = [

[[package]]
name = "gccjit"
version = "2.7.0"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae99a89184220d967dd300139f2d2ae7d52c1a69d632b24aacc57c54625254ce"
checksum = "4a0e310ef75f396cd11b2443b353d55376656ca92c13cba36f92b7aff346ac1a"
dependencies = [
"gccjit_sys",
]

[[package]]
name = "gccjit_sys"
version = "0.8.0"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24edb7bfe2b7b27c6d09ed23eebfcab0b359c8fe978433f902943e6f127a0f1b"
checksum = "95ed7572b30cd32430294dde6fb70822d58e67c6846a548647e8739776a0125b"
dependencies = [
"libc",
]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ default = ["master"]
[dependencies]
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
tempfile = "3.20"
gccjit = "2.7"
gccjit = "2.8"
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs" }

# Local copy.
Expand Down
30 changes: 28 additions & 2 deletions compiler/rustc_codegen_gcc/build_system/src/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::ffi::OsStr;
use std::path::Path;

use crate::utils::run_command_with_output;
use crate::utils::{run_command_with_output, walk_dir};

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

run_command_with_output(cmd, Some(Path::new(".")))?;
run_command_with_output(cmd, Some(Path::new("build_system")))
run_command_with_output(cmd, Some(Path::new("build_system")))?;

run_rustfmt_recursively("tests/run", check)
}

fn run_rustfmt_recursively<P>(dir: P, check: bool) -> Result<(), String>
where
P: AsRef<Path>,
{
walk_dir(
dir,
&mut |dir| run_rustfmt_recursively(dir, check),
&mut |file_path| {
if file_path.extension().filter(|ext| ext == &OsStr::new("rs")).is_some() {
let rustfmt_cmd: &[&dyn AsRef<OsStr>] = if check {
&[&"rustfmt", &"--check", &file_path]
} else {
&[&"rustfmt", &file_path]
};

run_command_with_output(rustfmt_cmd, Some(Path::new(".")))
} else {
Ok(())
}
},
true,
)
}
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
r#"change-id = 115898

[rust]
codegen-backends = []
codegen-backends = ["gcc"]
deny-warnings = false
verbose-tests = true

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/libgccjit.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
04ce66d8c918de9273bd7101638ad8724edf5e21
4e995bd73c4490edfe5080ec6014d63aa9abed5f
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-08-03"
channel = "nightly-2025-08-25"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
1 change: 0 additions & 1 deletion compiler/rustc_codegen_gcc/src/intrinsic/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,6 @@ fn simd_funnel_shift<'a, 'gcc, 'tcx>(
let index = bx.context.new_rvalue_from_int(bx.int_type, i as i32);
let a_val = bx.context.new_vector_access(None, a, index).to_rvalue();
let a_val = bx.context.new_bitcast(None, a_val, unsigned_type);
// TODO: we probably need to use gcc_int_cast instead.
let a_val = bx.gcc_int_cast(a_val, new_int_type);
let b_val = bx.context.new_vector_access(None, b, index).to_rvalue();
let b_val = bx.context.new_bitcast(None, b_val, unsigned_type);
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_codegen_gcc/tests/failing-run-make-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ tests/run-make/doctests-keep-binaries/
tests/run-make/doctests-runtool/
tests/run-make/emit-shared-files/
tests/run-make/exit-code/
tests/run-make/issue-64153/
tests/run-make/llvm-ident/
tests/run-make/native-link-modifier-bundle/
tests/run-make/remap-path-prefix-dwarf/
Expand Down Expand Up @@ -34,8 +33,6 @@ tests/run-make/c-link-to-rust-staticlib/
tests/run-make/foreign-double-unwind/
tests/run-make/foreign-exceptions/
tests/run-make/glibc-staticlib-args/
tests/run-make/issue-36710/
tests/run-make/issue-68794-textrel-on-minimal-lib/
tests/run-make/lto-smoke-c/
tests/run-make/return-non-c-like-enum/

4 changes: 3 additions & 1 deletion compiler/rustc_codegen_gcc/tests/failing-ui-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tests/ui/drop/dynamic-drop.rs
tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs
tests/ui/simd/issue-17170.rs
tests/ui/simd/issue-39720.rs
tests/ui/issues/issue-14875.rs
tests/ui/drop/panic-during-drop-14875.rs
tests/ui/issues/issue-29948.rs
tests/ui/process/println-with-broken-pipe.rs
tests/ui/lto/thin-lto-inlines2.rs
Expand Down Expand Up @@ -86,3 +86,5 @@ tests/ui/panics/unwind-force-no-unwind-tables.rs
tests/ui/attributes/fn-align-dyn.rs
tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs
tests/ui/explicit-tail-calls/recursion-etc.rs
tests/ui/explicit-tail-calls/indexer.rs
tests/ui/explicit-tail-calls/drop-order.rs
10 changes: 4 additions & 6 deletions compiler/rustc_codegen_gcc/tests/run/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ fn main() {
use std::hint::black_box;

macro_rules! check {
($ty:ty, $expr:expr) => {
{
const EXPECTED: $ty = $expr;
assert_eq!($expr, EXPECTED);
}
};
($ty:ty, $expr:expr) => {{
const EXPECTED: $ty = $expr;
assert_eq!($expr, EXPECTED);
}};
}

check!(u32, (2220326408_u32 + black_box(1)) >> (32 - 6));
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/tests/run/int_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() {

let arg_count = std::env::args().count();
let int = isize::MAX;
let _int = int + arg_count as isize; // overflow
let _int = int + arg_count as isize; // overflow

// If overflow checking is disabled, we should reach here.
#[cfg(not(debug_assertions))]
Expand Down
8 changes: 2 additions & 6 deletions compiler/rustc_codegen_gcc/tests/run/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ fn one() -> isize {

#[no_mangle]
extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
let test = Test {
field: one(),
};
let two = Two {
two: 2,
};
let test = Test { field: one() };
let two = Two { two: 2 };
unsafe {
libc::printf(b"%ld\n\0" as *const u8 as *const i8, test.field);
libc::printf(b"%ld\n\0" as *const u8 as *const i8, two.two);
Expand Down
8 changes: 2 additions & 6 deletions compiler/rustc_codegen_gcc/tests/run/volatile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ struct Struct {
func: unsafe fn(*const ()),
}

fn func(_ptr: *const ()) {
}
fn func(_ptr: *const ()) {}

fn main() {
let mut x = MaybeUninit::<&Struct>::uninit();
x.write(&Struct {
pointer: std::ptr::null(),
func,
});
x.write(&Struct { pointer: std::ptr::null(), func });
let x = unsafe { x.assume_init() };
let value = unsafe { (x as *const Struct).read_volatile() };
println!("{:?}", value);
Expand Down
12 changes: 10 additions & 2 deletions compiler/rustc_codegen_gcc/tests/run/volatile2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ mod libc {
#[link(name = "c")]
extern "C" {
pub fn sigaction(signum: i32, act: *const sigaction, oldact: *mut sigaction) -> i32;
pub fn mmap(addr: *mut (), len: usize, prot: i32, flags: i32, fd: i32, offset: i64) -> *mut ();
pub fn mmap(
addr: *mut (),
len: usize,
prot: i32,
flags: i32,
fd: i32,
offset: i64,
) -> *mut ();
pub fn mprotect(addr: *mut (), len: usize, prot: i32) -> i32;
}

Expand Down Expand Up @@ -54,7 +61,8 @@ fn main() {
libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
-1,
0,
).cast();
)
.cast();
if STORAGE == libc::MAP_FAILED {
panic!("error: mmap failed");
}
Expand Down
2 changes: 1 addition & 1 deletion src/gcc
Submodule gcc updated 12418 files
Loading