Auto merge of #145890 - GuillaumeGomez:subtree-update_cg_gcc_2025-08-26, r=GuillaumeGomez
GCC backend subtree update cc `@antoyo` r? ghost
This commit is contained in:
@@ -82,20 +82,16 @@ jobs:
|
|||||||
- name: Build sample project with target defined as JSON spec
|
- name: Build sample project with target defined as JSON spec
|
||||||
run: |
|
run: |
|
||||||
./y.sh prepare --only-libcore --cross
|
./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
|
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
|
./y.sh clean all
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
./y.sh prepare --only-libcore --cross
|
./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
|
./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
|
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests --target-triple m68k-unknown-linux-gnu
|
||||||
# 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
|
|
||||||
./y.sh clean all
|
./y.sh clean all
|
||||||
|
|
||||||
- name: Prepare dependencies
|
- name: Prepare dependencies
|
||||||
@@ -104,23 +100,21 @@ jobs:
|
|||||||
git config --global user.name "User"
|
git config --global user.name "User"
|
||||||
./y.sh prepare --cross
|
./y.sh prepare --cross
|
||||||
|
|
||||||
# FIXME: We cannot run programs for architectures not supported by the object crate. See comment above.
|
- name: Run tests
|
||||||
#- name: Run tests
|
run: |
|
||||||
#run: |
|
./y.sh test --target-triple m68k-unknown-linux-gnu --release --clean --build-sysroot ${{ matrix.commands }}
|
||||||
#./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!
|
||||||
#- name: Run Hello World!
|
run: |
|
||||||
#run: |
|
./y.sh build --target-triple m68k-unknown-linux-gnu
|
||||||
#./y.sh build --target-triple m68k-unknown-linux-gnu
|
|
||||||
|
|
||||||
#vm_dir=$(pwd)/vm
|
vm_dir=$(pwd)/vm
|
||||||
#cd tests/hello-world
|
cd tests/hello-world
|
||||||
#CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ../../y.sh cargo build --target m68k-unknown-linux-gnu
|
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 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
|
sudo chroot $vm_dir qemu-m68k-static /home/hello_world > hello_world_stdout
|
||||||
#expected_output="40"
|
expected_output="40"
|
||||||
#test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)
|
test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)
|
||||||
|
|
||||||
# Summary job for the merge queue.
|
# Summary job for the merge queue.
|
||||||
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
|
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
|
||||||
|
|||||||
@@ -56,18 +56,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gccjit"
|
name = "gccjit"
|
||||||
version = "2.7.0"
|
version = "2.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ae99a89184220d967dd300139f2d2ae7d52c1a69d632b24aacc57c54625254ce"
|
checksum = "4a0e310ef75f396cd11b2443b353d55376656ca92c13cba36f92b7aff346ac1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gccjit_sys",
|
"gccjit_sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gccjit_sys"
|
name = "gccjit_sys"
|
||||||
version = "0.8.0"
|
version = "0.8.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "24edb7bfe2b7b27c6d09ed23eebfcab0b359c8fe978433f902943e6f127a0f1b"
|
checksum = "95ed7572b30cd32430294dde6fb70822d58e67c6846a548647e8739776a0125b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ default = ["master"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
|
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
|
||||||
tempfile = "3.20"
|
tempfile = "3.20"
|
||||||
gccjit = "2.7"
|
gccjit = "2.8"
|
||||||
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs" }
|
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs" }
|
||||||
|
|
||||||
# Local copy.
|
# Local copy.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::utils::run_command_with_output;
|
use crate::utils::{run_command_with_output, walk_dir};
|
||||||
|
|
||||||
fn show_usage() {
|
fn show_usage() {
|
||||||
println!(
|
println!(
|
||||||
@@ -32,5 +32,31 @@ pub fn run() -> Result<(), String> {
|
|||||||
if check { &[&"cargo", &"fmt", &"--check"] } else { &[&"cargo", &"fmt"] };
|
if check { &[&"cargo", &"fmt", &"--check"] } else { &[&"cargo", &"fmt"] };
|
||||||
|
|
||||||
run_command_with_output(cmd, Some(Path::new(".")))?;
|
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,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
|
|||||||
r#"change-id = 115898
|
r#"change-id = 115898
|
||||||
|
|
||||||
[rust]
|
[rust]
|
||||||
codegen-backends = []
|
codegen-backends = ["gcc"]
|
||||||
deny-warnings = false
|
deny-warnings = false
|
||||||
verbose-tests = true
|
verbose-tests = true
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
04ce66d8c918de9273bd7101638ad8724edf5e21
|
4e995bd73c4490edfe5080ec6014d63aa9abed5f
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2025-08-03"
|
channel = "nightly-2025-08-25"
|
||||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||||
|
|||||||
@@ -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 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_vector_access(None, a, index).to_rvalue();
|
||||||
let a_val = bx.context.new_bitcast(None, a_val, unsigned_type);
|
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 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_vector_access(None, b, index).to_rvalue();
|
||||||
let b_val = bx.context.new_bitcast(None, b_val, unsigned_type);
|
let b_val = bx.context.new_bitcast(None, b_val, unsigned_type);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ tests/run-make/doctests-keep-binaries/
|
|||||||
tests/run-make/doctests-runtool/
|
tests/run-make/doctests-runtool/
|
||||||
tests/run-make/emit-shared-files/
|
tests/run-make/emit-shared-files/
|
||||||
tests/run-make/exit-code/
|
tests/run-make/exit-code/
|
||||||
tests/run-make/issue-64153/
|
|
||||||
tests/run-make/llvm-ident/
|
tests/run-make/llvm-ident/
|
||||||
tests/run-make/native-link-modifier-bundle/
|
tests/run-make/native-link-modifier-bundle/
|
||||||
tests/run-make/remap-path-prefix-dwarf/
|
tests/run-make/remap-path-prefix-dwarf/
|
||||||
@@ -34,8 +33,6 @@ tests/run-make/c-link-to-rust-staticlib/
|
|||||||
tests/run-make/foreign-double-unwind/
|
tests/run-make/foreign-double-unwind/
|
||||||
tests/run-make/foreign-exceptions/
|
tests/run-make/foreign-exceptions/
|
||||||
tests/run-make/glibc-staticlib-args/
|
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/lto-smoke-c/
|
||||||
tests/run-make/return-non-c-like-enum/
|
tests/run-make/return-non-c-like-enum/
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ tests/ui/drop/dynamic-drop.rs
|
|||||||
tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs
|
tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs
|
||||||
tests/ui/simd/issue-17170.rs
|
tests/ui/simd/issue-17170.rs
|
||||||
tests/ui/simd/issue-39720.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/issues/issue-29948.rs
|
||||||
tests/ui/process/println-with-broken-pipe.rs
|
tests/ui/process/println-with-broken-pipe.rs
|
||||||
tests/ui/lto/thin-lto-inlines2.rs
|
tests/ui/lto/thin-lto-inlines2.rs
|
||||||
@@ -86,3 +86,5 @@ tests/ui/panics/unwind-force-no-unwind-tables.rs
|
|||||||
tests/ui/attributes/fn-align-dyn.rs
|
tests/ui/attributes/fn-align-dyn.rs
|
||||||
tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.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/recursion-etc.rs
|
||||||
|
tests/ui/explicit-tail-calls/indexer.rs
|
||||||
|
tests/ui/explicit-tail-calls/drop-order.rs
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ fn main() {
|
|||||||
use std::hint::black_box;
|
use std::hint::black_box;
|
||||||
|
|
||||||
macro_rules! check {
|
macro_rules! check {
|
||||||
($ty:ty, $expr:expr) => {
|
($ty:ty, $expr:expr) => {{
|
||||||
{
|
const EXPECTED: $ty = $expr;
|
||||||
const EXPECTED: $ty = $expr;
|
assert_eq!($expr, EXPECTED);
|
||||||
assert_eq!($expr, EXPECTED);
|
}};
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check!(u32, (2220326408_u32 + black_box(1)) >> (32 - 6));
|
check!(u32, (2220326408_u32 + black_box(1)) >> (32 - 6));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ fn main() {
|
|||||||
|
|
||||||
let arg_count = std::env::args().count();
|
let arg_count = std::env::args().count();
|
||||||
let int = isize::MAX;
|
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.
|
// If overflow checking is disabled, we should reach here.
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
|
|||||||
@@ -27,12 +27,8 @@ fn one() -> isize {
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
|
extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
|
||||||
let test = Test {
|
let test = Test { field: one() };
|
||||||
field: one(),
|
let two = Two { two: 2 };
|
||||||
};
|
|
||||||
let two = Two {
|
|
||||||
two: 2,
|
|
||||||
};
|
|
||||||
unsafe {
|
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, test.field);
|
||||||
libc::printf(b"%ld\n\0" as *const u8 as *const i8, two.two);
|
libc::printf(b"%ld\n\0" as *const u8 as *const i8, two.two);
|
||||||
|
|||||||
@@ -12,15 +12,11 @@ struct Struct {
|
|||||||
func: unsafe fn(*const ()),
|
func: unsafe fn(*const ()),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn func(_ptr: *const ()) {
|
fn func(_ptr: *const ()) {}
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = MaybeUninit::<&Struct>::uninit();
|
let mut x = MaybeUninit::<&Struct>::uninit();
|
||||||
x.write(&Struct {
|
x.write(&Struct { pointer: std::ptr::null(), func });
|
||||||
pointer: std::ptr::null(),
|
|
||||||
func,
|
|
||||||
});
|
|
||||||
let x = unsafe { x.assume_init() };
|
let x = unsafe { x.assume_init() };
|
||||||
let value = unsafe { (x as *const Struct).read_volatile() };
|
let value = unsafe { (x as *const Struct).read_volatile() };
|
||||||
println!("{:?}", value);
|
println!("{:?}", value);
|
||||||
|
|||||||
@@ -7,7 +7,14 @@ mod libc {
|
|||||||
#[link(name = "c")]
|
#[link(name = "c")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn sigaction(signum: i32, act: *const sigaction, oldact: *mut sigaction) -> i32;
|
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;
|
pub fn mprotect(addr: *mut (), len: usize, prot: i32) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +61,8 @@ fn main() {
|
|||||||
libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
|
libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
|
||||||
-1,
|
-1,
|
||||||
0,
|
0,
|
||||||
).cast();
|
)
|
||||||
|
.cast();
|
||||||
if STORAGE == libc::MAP_FAILED {
|
if STORAGE == libc::MAP_FAILED {
|
||||||
panic!("error: mmap failed");
|
panic!("error: mmap failed");
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/gcc
2
src/gcc
Submodule src/gcc updated: 04ce66d8c9...4e995bd73c
Reference in New Issue
Block a user