Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
0415c11
Directly raise fatal errors inside the codegen backends
bjorn3 Aug 24, 2025
a224101
Merge commit 'feb42827f11a7ae241ceecc81e9ae556fb6ba214' into subtree-…
GuillaumeGomez Aug 26, 2025
059f00d
Fix sync conflict
GuillaumeGomez Aug 26, 2025
26736f9
fix target-pointer-width in tests
WaffleLapkin Jul 31, 2025
01ef552
Update GCC version
antoyo Aug 28, 2025
35cd7f5
Merge pull request #755 from rust-lang/update-gcc-2025-08-28
antoyo Aug 28, 2025
c1477c3
Special case allocator module submission to avoid special casing it e…
bjorn3 Aug 28, 2025
fada75d
cg_gcc: run `run-make-cargo` tests
jieyouxu Sep 5, 2025
03aa02f
Rework some build_system/utils return value
dvermd Sep 5, 2025
bd33abf
Remove thin_link_data method from ThinBufferMethods
bjorn3 Aug 15, 2025
79955e1
Remove want_summary argument from prepare_thin
bjorn3 Sep 4, 2025
bd303ca
Always pass git options to run_command
dvermd Sep 5, 2025
d5e9cc5
Rollup merge of #146209 - bjorn3:lto_refactors5, r=dianqk
matthiaskrgr Sep 7, 2025
a211d63
erase_regions to erase_and_anonymize_regions
BoxyUwU Aug 21, 2025
2d2aad3
allow `#[rustc_align_static(N)]` on `static`s
folkertdev Jun 7, 2025
655a519
Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ral…
matthiaskrgr Sep 10, 2025
b5b58d1
Remove unreachable unsized arg handling in `store_fn_arg/store_arg` i…
zachs18 Sep 12, 2025
3f93968
Merge branch 'master' into sync_from_rust_2025_09_16
antoyo Sep 16, 2025
dbc3ace
Update to nightly-2025-09-16
antoyo Sep 16, 2025
b072f38
Ignore failing test
antoyo Sep 16, 2025
8ecf880
added typetree support for memcpy
KMJ-007 Aug 23, 2025
ee849b0
Switch to Ubuntu Plucky repository because Oracular is not supported …
antoyo Sep 20, 2025
7c12d9d
Disable funnel shift tests since they fail
antoyo Sep 20, 2025
5c50a42
Merge pull request #760 from rust-lang/sync_from_rust_2025_09_16
antoyo Sep 20, 2025
b9a2e04
Support ctr and lr as clobber-only registers in PowerPC inline assembly
taiki-e Sep 21, 2025
8f24436
Add panic=immediate-abort
saethlin Sep 7, 2025
465d04a
Auto merge of #146317 - saethlin:panic=immediate-abort, r=nnethercote
bors Sep 23, 2025
994d3e1
Add an attribute to check the number of lanes in a SIMD vector after …
calebzulawski Sep 16, 2025
900fcfd
Rollup merge of #146667 - calebzulawski:simd-mono-lane-limit, r=lcnr,…
Zalathar Sep 25, 2025
62c1eea
Rollup merge of #144197 - KMJ-007:type-tree, r=ZuseZ4
matthiaskrgr Sep 28, 2025
7587323
Add a leading dash to linker plugin arguments in the gcc codegen
antoyo Sep 28, 2025
9159b61
remove explicit deref of AbiAlign for most methods
workingjubilee Sep 28, 2025
867a310
Rollup merge of #147127 - antoyo:fix/gcc-linker-plugin, r=bjorn3
Zalathar Sep 29, 2025
68c97a8
Auto merge of #147145 - Zalathar:rollup-s7kcs3w, r=Zalathar
bors Sep 29, 2025
44790a9
Merge branch 'master' into sync_from_rust_2025_09_29
antoyo Sep 29, 2025
346f79b
Merge pull request #759 from dvermd/default_git_user_info
antoyo Sep 29, 2025
a2b536a
Update to nightly-2025-09-30
antoyo Sep 29, 2025
80340cd
Merge pull request #763 from rust-lang/sync_from_rust_2025_09_29
antoyo Oct 1, 2025
0127601
Stop ignoring the clippy lint suspicious_else_formatting
antoyo Sep 22, 2025
3fdf349
Fix and re-enable mini-core test
antoyo Sep 22, 2025
5e6e797
Remove passing run-make tests
antoyo Sep 24, 2025
f951fee
Clean all test directories
antoyo Sep 24, 2025
06a51e4
Merge pull request #768 from rust-lang/remove-passing-run-make-tests
antoyo Oct 1, 2025
1c8a353
Merge pull request #766 from rust-lang/fix/mini-tests
antoyo Oct 1, 2025
1f6e396
Merge pull request #764 from rust-lang/remove-clippy-suspicious-else-…
antoyo Oct 1, 2025
8deca81
Fix shifting a value of a smaller type to a bigger type
antoyo Sep 22, 2025
2426181
Merge pull request #767 from rust-lang/clean-all-tests
antoyo Oct 1, 2025
97e1942
Merge pull request #765 from rust-lang/fix/shift
antoyo Oct 1, 2025
243ef31
Add test for cross-language LTO
antoyo Sep 22, 2025
5cb8d34
Merge pull request #769 from rust-lang/fix/cross-lto
antoyo Oct 2, 2025
c9145e1
codegen: Generate `dbg_value` for the ref statement
dianqk Jun 18, 2025
130a8e9
Add `dejagnu` to the quickstart installation command line
winstonallo Oct 8, 2025
a909779
Move dejagnu install step to libgccjit tests documentation
winstonallo Oct 8, 2025
87c59b8
Remove dejagnu install from libgccjit tests run instructions
winstonallo Oct 8, 2025
d7e37d9
Add colon to Install dejagnu step for consistency
winstonallo Oct 8, 2025
5384032
Update GCC version
antoyo Oct 3, 2025
36d02fc
Merge pull request #772 from winstonallo/patch-1
antoyo Oct 8, 2025
3a8b6a1
Merge pull request #770 from rust-lang/update-gcc-2025-10-03
antoyo Oct 8, 2025
b70b304
Remove EMBED_LTO_BITCODE
antoyo May 20, 2025
af86f4e
Fix to do LTO when requested
antoyo May 20, 2025
b0777f2
Fix to not do LTO when LTO is not enabled in gcc
antoyo May 21, 2025
2f2a834
Fix to forward lto_supported and lto_mode where needed
antoyo Jun 15, 2025
0166bfc
Fix clippy warning
antoyo Jul 1, 2025
7a5ee0f
Only check if LTO is enabled when using the master branch of libgccjit
antoyo Jun 15, 2025
81bbe14
Remove comment
antoyo Jun 15, 2025
ea362b2
Fix to remove messages to stderr when LTO is not suppported by using …
antoyo Oct 9, 2025
1e4b273
Update GCC version
antoyo Oct 9, 2025
b25c2bf
Merge pull request #678 from rust-lang/remove-embed-lto-bitcode
antoyo Oct 10, 2025
7b71e54
Support #[alloc_error_handler] without the allocator shim
bjorn3 Jun 26, 2025
5f0d88f
Move computation of allocator shim contents to cg_ssa
bjorn3 Oct 9, 2025
e83aa35
Remove remaining usage of EMBED_LTO_BITCODE
antoyo Oct 10, 2025
a50f0b4
Remove failing-lto-tests.txt
antoyo Oct 10, 2025
784f11d
Do not generate fat objects when not needed
antoyo Oct 10, 2025
e44d493
Correctly embed the bitcode when compiling the sysroot
antoyo Oct 10, 2025
9cc826c
Merge pull request #773 from rust-lang/fix/undefined-symbols-lto
antoyo Oct 10, 2025
2cd4f67
Clean the sysroot destination directory before copying the content in…
antoyo Oct 11, 2025
a949fa1
Merge pull request #778 from rust-lang/fix/multiple-candidates-error-…
antoyo Oct 11, 2025
5544f5d
Remove passing tests from failing-ui-tests.txt
antoyo Oct 12, 2025
a93f531
Stop removing some test directories
antoyo Oct 12, 2025
28d461d
Merge pull request #780 from rust-lang/remove-failing-tests
antoyo Oct 12, 2025
2064793
Allow vector-scalar (vs) registers in ppc inline assembly
pmur Sep 19, 2025
d96167f
Implement ppc/ppc64 preserves_flags option for inline asm
pmur Sep 22, 2025
d2ade4e
Rollup merge of #146949 - pmur:murp/improve-ppc-inline-asm, r=Amanieu
matthiaskrgr Oct 15, 2025
c5d02bb
Restrict sysroot crate imports to those defined in this repo.
Diggsey Jul 6, 2025
825f2bf
Auto merge of #143548 - Diggsey:db-limit-extern-crate-usage, r=oli-obk
bors Oct 15, 2025
936805e
Fix ICE on offsetted ZST pointer
Mark-Simulacrum Oct 11, 2025
f870dd2
Rollup merge of #147576 - Mark-Simulacrum:fix-offset-zst, r=nnetherco…
matthiaskrgr Oct 16, 2025
0f5c80a
remove broken link
Kivooeo Oct 20, 2025
77a9796
Fix RAM usage by splitting deeply nested expressions
antoyo Oct 26, 2025
f3ab60b
Implement reg vector type
antoyo Oct 26, 2025
8e737d6
Merge pull request #786 from rust-lang/reg-vector-type
antoyo Oct 27, 2025
13230c0
Merge pull request #783 from rust-lang/fix/ram-usage
antoyo Oct 27, 2025
36c35d7
Regenerate intrinsics
GuillaumeGomez Oct 28, 2025
e7b5847
Merge pull request #793 from GuillaumeGomez/regen-intrinsics-2
antoyo Oct 28, 2025
93b5b1b
Merge branch 'master' into sync_from_rust_2025_11_01
antoyo Nov 1, 2025
02608ff
Update to nightly-2025-11-01
antoyo Nov 1, 2025
cd5a50d
Fix mini_core tests
antoyo Nov 1, 2025
76a7e79
Update to nightly-2025-11-04
antoyo Nov 4, 2025
e785c50
Merge pull request #795 from rust-lang/sync_from_rust_2025_11_01
antoyo Nov 4, 2025
ca3e2ea
Merge commit 'e785c50dad2944c7b4fb2d929de531f859db1e99' into subtree-…
GuillaumeGomez Nov 4, 2025
dcc2f33
Update GCC submodule
GuillaumeGomez Nov 4, 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
28 changes: 19 additions & 9 deletions compiler/rustc_codegen_gcc/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Build
run: |
./y.sh prepare --only-libcore
EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
./y.sh build --sysroot --release --release-sysroot
./y.sh test --cargo-tests
./y.sh clean all

Expand All @@ -72,26 +72,36 @@ jobs:
git config --global user.name "User"
./y.sh prepare

- name: Add more failing tests because of undefined symbol errors (FIXME)
run: cat tests/failing-lto-tests.txt >> tests/failing-ui-tests.txt

- name: Run tests
run: |
# FIXME(antoyo): we cannot enable LTO for stdarch tests currently because of some failing LTO tests using proc-macros.
# FIXME(antoyo): this should probably not be needed since we embed the LTO bitcode.
printf '[profile.release]\nlto = "fat"\n' >> build/build_sysroot/sysroot_src/library/Cargo.toml
EMBED_LTO_BITCODE=1 ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}
CG_RUSTFLAGS="-Cembed-bitcode=yes" ./y.sh test --release --clean --release-sysroot --build-sysroot --keep-lto-tests ${{ matrix.commands }}

- name: Run y.sh cargo build
- name: LTO test
run: |
EMBED_LTO_BITCODE=1 CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
CHANNEL="release" ./y.sh cargo build --release --manifest-path tests/hello-world/Cargo.toml
call_found=$(objdump -dj .text tests/hello-world/target/release/hello_world | grep -c "call .*mylib.*my_func" ) ||:
if [ $call_found -gt 0 ]; then
echo "ERROR: call my_func found in asm"
echo "Test is done with LTO enabled, hence inlining should occur across crates"
exit 1
fi

- name: Cross-language LTO test
run: |
pushd tests/cross_lang_lto
gcc -c -flto add.c -masm=intel -fPIC -O3
ar rcs libadd.a add.o
popd

CHANNEL="release" CG_RUSTFLAGS="-L native=. -Clinker-plugin-lto -Clinker=gcc" ./y.sh cargo build --release --manifest-path tests/cross_lang_lto/Cargo.toml
call_found=$(objdump -dj .text tests/cross_lang_lto/target/release/cross_lang_lto | grep -c "call .*my_add" ) ||:
if [ $call_found -gt 0 ]; then
echo "ERROR: call my_add found in asm"
echo "Test is done with cross-language LTO enabled, hence inlining should occur across object files"
exit 1
fi

# Summary job for the merge queue.
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
success_release:
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
# TODO: remove when we have binutils version 2.43 in the repo.
- name: Install more recent binutils
run: |
echo "deb http://archive.ubuntu.com/ubuntu oracular main universe" | sudo tee /etc/apt/sources.list.d/oracular-copies.list
echo "deb http://archive.ubuntu.com/ubuntu plucky main universe" | sudo tee /etc/apt/sources.list.d/plucky-copies.list
sudo apt-get update
sudo apt-get install binutils

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.9.0"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a0e310ef75f396cd11b2443b353d55376656ca92c13cba36f92b7aff346ac1a"
checksum = "60362e038e71e4bdc1a5b23fb45e1aba587b5947fe0db58f4871d95608f89eca"
dependencies = [
"gccjit_sys",
]

[[package]]
name = "gccjit_sys"
version = "0.8.2"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ed7572b30cd32430294dde6fb70822d58e67c6846a548647e8739776a0125b"
checksum = "ddd542c8414e122217551c6af6b7d33acf51a227aee85276f218c087525e01bb"
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.8"
gccjit = "2.10"
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs" }

# Local copy.
Expand Down
18 changes: 7 additions & 11 deletions compiler/rustc_codegen_gcc/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ $ ../gcc/configure \
$ make -j4 # You can replace `4` with another number depending on how many cores you have.
```

If you want to run libgccjit tests, you will need to also enable the C++ language in the `configure`:
If you want to run libgccjit tests, you will need to
* Enable the C++ language in the `configure` step:

```bash
--enable-languages=jit,c++
```
* Install [dejagnu](https://www.gnu.org/software/dejagnu/#downloading) to run the tests:

```bash
$ sudo apt install dejagnu
```

Then to run libgccjit tests:

Expand Down Expand Up @@ -135,16 +141,6 @@ $ CHANNEL="release" $CG_GCCJIT_DIR/y.sh cargo run

If you compiled cg_gccjit in debug mode (aka you didn't pass `--release` to `./y.sh test`) you should use `CHANNEL="debug"` instead or omit `CHANNEL="release"` completely.

### LTO

To use LTO, you need to set the variable `EMBED_LTO_BITCODE=1` in addition to setting `lto = "fat"` in the `Cargo.toml`.

Failing to set `EMBED_LTO_BITCODE` will give you the following error:

```
error: failed to copy bitcode to object file: No such file or directory (os error 2)
```

### Rustc

If you want to run `rustc` directly, you can do so with:
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_gcc/build_system/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu

// Copy files to sysroot
let sysroot_path = start_dir.join(format!("sysroot/lib/rustlib/{}/lib/", config.target_triple));
// To avoid errors like "multiple candidates for `rmeta` dependency `core` found", we clean the
// sysroot directory before copying the sysroot build artifacts.
let _ = fs::remove_dir_all(&sysroot_path);
create_dir(&sysroot_path)?;
let mut copier = |dir_to_copy: &Path| {
// FIXME: should not use shell command!
Expand Down
9 changes: 7 additions & 2 deletions compiler/rustc_codegen_gcc/build_system/src/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ fn clean_all() -> Result<(), String> {
}

fn clean_ui_tests() -> Result<(), String> {
let path = Path::new(crate::BUILD_DIR).join("rust/build/x86_64-unknown-linux-gnu/test/ui/");
run_command(&[&"find", &path, &"-name", &"stamp", &"-delete"], None)?;
let directories = ["run-make", "run-make-cargo", "ui"];
for directory in directories {
let path = Path::new(crate::BUILD_DIR)
.join("rust/build/x86_64-unknown-linux-gnu/test/")
.join(directory);
run_command(&[&"find", &path, &"-name", &"stamp", &"-delete"], None)?;
}
Ok(())
}

Expand Down
72 changes: 52 additions & 20 deletions compiler/rustc_codegen_gcc/build_system/src/prepare.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,49 @@
use std::ffi::OsStr;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Output;

use crate::rustc_info::get_rustc_path;
use crate::utils::{
cargo_install, create_dir, get_sysroot_dir, git_clone_root_dir, remove_file, run_command,
run_command_with_output, walk_dir,
};

// This is needed on systems where nothing is configured.
// git really needs something here, or it will fail.
// Even using --author is not enough.
const GIT_CMD: [&dyn AsRef<OsStr>; 9] = [
&"git",
&"-c",
&"user.name=None",
&"-c",
&"user.email=none@example.com",
&"-c",
&"core.autocrlf=false",
&"-c",
&"commit.gpgSign=false",
];

fn run_git_command(
command: &dyn AsRef<OsStr>,
input: &[&dyn AsRef<OsStr>],
cwd: Option<&Path>,
) -> Result<Output, String> {
let git_cmd =
&GIT_CMD.into_iter().chain([command]).chain(input.iter().cloned()).collect::<Vec<_>>()[..];
run_command(git_cmd, cwd)
}

fn run_git_command_with_output(
command: &dyn AsRef<OsStr>,
input: &[&dyn AsRef<OsStr>],
cwd: Option<&Path>,
) -> Result<(), String> {
let git_cmd =
&GIT_CMD.into_iter().chain([command]).chain(input.iter().cloned()).collect::<Vec<_>>()[..];
run_command_with_output(git_cmd, cwd)
}

fn prepare_libcore(
sysroot_path: &Path,
libgccjit12_patches: bool,
Expand Down Expand Up @@ -55,19 +92,12 @@ fn prepare_libcore(
run_command(&[&"cp", &"-r", &rustlib_dir.join("library"), &sysroot_dir], None)?;

println!("[GIT] init (cwd): `{}`", sysroot_dir.display());
run_command(&[&"git", &"init"], Some(&sysroot_dir))?;
run_git_command(&"init", &[], Some(&sysroot_dir))?;
println!("[GIT] add (cwd): `{}`", sysroot_dir.display());
run_command(&[&"git", &"add", &"."], Some(&sysroot_dir))?;
run_git_command(&"add", &[&"."], Some(&sysroot_dir))?;
println!("[GIT] commit (cwd): `{}`", sysroot_dir.display());

// This is needed on systems where nothing is configured.
// git really needs something here, or it will fail.
// Even using --author is not enough.
run_command(&[&"git", &"config", &"user.email", &"none@example.com"], Some(&sysroot_dir))?;
run_command(&[&"git", &"config", &"user.name", &"None"], Some(&sysroot_dir))?;
run_command(&[&"git", &"config", &"core.autocrlf", &"false"], Some(&sysroot_dir))?;
run_command(&[&"git", &"config", &"commit.gpgSign", &"false"], Some(&sysroot_dir))?;
run_command(&[&"git", &"commit", &"-m", &"Initial commit", &"-q"], Some(&sysroot_dir))?;
run_git_command(&"commit", &[&"-m", &"Initial commit", &"-q"], Some(&sysroot_dir))?;

let mut patches = Vec::new();
walk_dir(
Expand Down Expand Up @@ -105,10 +135,11 @@ fn prepare_libcore(
for file_path in patches {
println!("[GIT] apply `{}`", file_path.display());
let path = Path::new("../../..").join(file_path);
run_command_with_output(&[&"git", &"apply", &path], Some(&sysroot_dir))?;
run_command_with_output(&[&"git", &"add", &"-A"], Some(&sysroot_dir))?;
run_command_with_output(
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
run_git_command_with_output(&"apply", &[&path], Some(&sysroot_dir))?;
run_git_command_with_output(&"add", &[&"-A"], Some(&sysroot_dir))?;
run_git_command_with_output(
&"commit",
&[&"-m", &format!("Patch {}", path.display())],
Some(&sysroot_dir),
)?;
}
Expand All @@ -124,10 +155,11 @@ fn prepare_rand() -> Result<(), String> {
let rand_dir = Path::new("build/rand");
println!("[GIT] apply `{file_path}`");
let path = Path::new("../..").join(file_path);
run_command_with_output(&[&"git", &"apply", &path], Some(rand_dir))?;
run_command_with_output(&[&"git", &"add", &"-A"], Some(rand_dir))?;
run_command_with_output(
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
run_git_command_with_output(&"apply", &[&path], Some(rand_dir))?;
run_git_command_with_output(&"add", &[&"-A"], Some(rand_dir))?;
run_git_command_with_output(
&"commit",
&[&"-m", &format!("Patch {}", path.display())],
Some(rand_dir),
)?;

Expand All @@ -154,8 +186,8 @@ where
println!("`{}` has already been cloned", clone_result.repo_name);
}
let repo_path = Path::new(crate::BUILD_DIR).join(&clone_result.repo_name);
run_command(&[&"git", &"checkout", &"--", &"."], Some(&repo_path))?;
run_command(&[&"git", &"checkout", &checkout_commit], Some(&repo_path))?;
run_git_command(&"checkout", &[&"--", &"."], Some(&repo_path))?;
run_git_command(&"checkout", &[&checkout_commit], Some(&repo_path))?;
if let Some(extra) = extra {
extra(&repo_path)?;
}
Expand Down
Loading
Loading