Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b3f16fd
Merge commit 'e785c50dad2944c7b4fb2d929de531f859db1e99' into subtree-…
GuillaumeGomez Nov 4, 2025
75f4028
rustc_target: introduce Arch
tamird Oct 13, 2025
44b269d
rustc_target: allow unenumerated architectures
tamird Oct 28, 2025
a6ca4f5
Move warning reporting from flag_to_backend_features to cfg_target_fe…
bjorn3 Nov 5, 2025
3a7f4c4
Unify the configuration of the compiler docs
bjorn3 Nov 5, 2025
1548ba6
Replace `allow` attributes with `expect` and remove unused attributes
GuillaumeGomez Nov 5, 2025
884cea1
Only generate `expect` attribute if needed
GuillaumeGomez Nov 5, 2025
f25ac1d
Merge pull request #797 from GuillaumeGomez/clean-up-allow
antoyo Nov 5, 2025
2b0da9b
Auto merge of #148516 - bjorn3:target_feature_parsing_improvements, r…
bors Nov 5, 2025
7d3a456
Auto merge of #148544 - matthiaskrgr:rollup-n9dqgwc, r=matthiaskrgr
bors Nov 5, 2025
f7b6605
Add -Zannotate-moves for profiler visibility of move/copy operations
jsgf Oct 13, 2025
3e1d537
Auto merge of #148481 - GuillaumeGomez:subtree-update_cg_gcc_2025-11-…
bors Nov 13, 2025
7ba799d
Merge branch 'master' into sync_from_rust_2025_11_13
antoyo Nov 13, 2025
0a7459b
Update to nightly-2025-11-13
antoyo Nov 13, 2025
95125dd
Add --bypass-ignore-backends flag
antoyo Nov 13, 2025
58684b3
Add new failing UI tests
antoyo Nov 13, 2025
9dd009e
Add back failing LTO tests
antoyo Nov 14, 2025
4767bbf
Remove passing UI test
antoyo Nov 14, 2025
db67f59
Merge pull request #800 from rust-lang/sync_from_rust_2025_11_13
antoyo Nov 14, 2025
2da6c16
Clarify -Cllvm-args forwarding to GCC in Readme
harin-ramesh Nov 23, 2025
e95bba1
docs: Move -Cllvm-args forwarding explanation to tips.md
harin-ramesh Nov 23, 2025
fdf04df
Merge pull request #803 from harin-ramesh/doc/issue-603
antoyo Nov 23, 2025
99a3e75
Update to nightly-2025-11-24
antoyo Nov 24, 2025
35e02dd
Switch from #[expect] to #[allow] because of a clippy bug
antoyo Nov 24, 2025
bd64989
Add failing UI tests
antoyo Nov 25, 2025
096b622
Implement simd_masked_load and simd_masked_store
antoyo Nov 25, 2025
92f9994
Add dummy mapping for new tile builtins
antoyo Nov 25, 2025
709f1cf
Merge pull request #804 from rust-lang/sync_from_rust_2025_11_24
antoyo Nov 25, 2025
cfcd7eb
Dlopen libgccjit.so in order to support multiple targets more easily
antoyo Nov 25, 2025
a9a8a9e
Merge pull request #805 from rust-lang/feature/dlopen
antoyo Nov 26, 2025
53dcfce
Update gccjit dependency
GuillaumeGomez Nov 26, 2025
9d4c385
Merge pull request #806 from GuillaumeGomez/update-dep
antoyo Nov 26, 2025
2567d81
Move libgccjit.so in the sysroot
antoyo Nov 26, 2025
55171cf
Merge pull request #807 from rust-lang/move-libgccjit-in-sysroot
antoyo Nov 26, 2025
9fce61b
Merge commit '55171cfa8b53970e06dcd2f5f2e2b8d82eeb0885' into subtree-…
GuillaumeGomez Nov 26, 2025
9776f45
Update GCC commit
GuillaumeGomez Nov 26, 2025
15b6fde
Update GCC submodule
GuillaumeGomez Nov 26, 2025
c939e90
Remove the extra `.0` at the end of the `libgccjit.so` file
GuillaumeGomez Nov 27, 2025
f94e90f
Remove outdated comment for `libgccjit.so.0`
GuillaumeGomez Nov 27, 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
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_gcc/.github/workflows/failures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ jobs:
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
run: |
echo 'gcc-path = "/usr/lib/gcc/x86_64-linux-gnu/12"' > config.toml
echo "LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV

- name: Download artifact
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_codegen_gcc/.github/workflows/gcc12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ jobs:
- name: Setup path to libgccjit
run: echo 'gcc-path = "/usr/lib/gcc/x86_64-linux-gnu/12"' > config.toml

- name: Set env
run: |
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
echo "LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12" >> $GITHUB_ENV

#- name: Cache rust repository
## We only clone the rust repository for rustc tests
#if: ${{ contains(matrix.commands, 'rustc') }}
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_gcc/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ jobs:
git config --global user.name "User"
./y.sh prepare

- name: Add more failing tests (some panic and debuginfo tests fail)
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.
Expand Down
9 changes: 1 addition & 8 deletions compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,15 @@ jobs:
sudo ln -s /usr/share/intel-sde/sde /usr/bin/sde
sudo ln -s /usr/share/intel-sde/sde64 /usr/bin/sde64

- name: Set env
- name: Set config
run: |
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
echo 'download-gccjit = true' > config.toml

- name: Build
run: |
./y.sh prepare --only-libcore
./y.sh build --sysroot --release --release-sysroot

- name: Set env (part 2)
run: |
# Set the `LD_LIBRARY_PATH` and `LIBRARY_PATH` env variables...
echo "LD_LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
echo "LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV

- name: Clean
if: ${{ !matrix.cargo_runner }}
run: |
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.10.0"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60362e038e71e4bdc1a5b23fb45e1aba587b5947fe0db58f4871d95608f89eca"
checksum = "ff80f4d6d0749eab3a69122210b3a1fdd52edb6162781aadd7c4842e26983683"
dependencies = [
"gccjit_sys",
]

[[package]]
name = "gccjit_sys"
version = "0.9.0"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddd542c8414e122217551c6af6b7d33acf51a227aee85276f218c087525e01bb"
checksum = "263da4f60b7bb5d6a5b21efda961741051ebdbf0e380a09118b03cce66a8c77e"
dependencies = [
"libc",
]
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_gcc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ default = ["master"]
[dependencies]
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
tempfile = "3.20"
gccjit = "2.10"
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs" }
gccjit = { version = "3.1.1", features = ["dlopen"] }
#gccjit = { git = "https://github.com/rust-lang/gccjit.rs", branch = "error-dlopen", features = ["dlopen"] }

# Local copy.
#gccjit = { path = "../gccjit.rs" }
#gccjit = { path = "../gccjit.rs", features = ["dlopen"] }

[dev-dependencies]
boml = "0.3.1"
Expand Down
24 changes: 15 additions & 9 deletions compiler/rustc_codegen_gcc/build_system/src/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs;
use std::path::Path;
use std::os::unix::fs::symlink;
use std::path::{Path, PathBuf};

use crate::config::{Channel, ConfigInfo};
use crate::utils::{
Expand Down Expand Up @@ -100,6 +101,18 @@ fn cleanup_sysroot_previous_build(library_dir: &Path) {
pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Result<(), String> {
let start_dir = get_sysroot_dir();

// Symlink libgccjit.so to sysroot.
let lib_path = start_dir.join("sysroot").join("lib");
let libgccjit_path =
PathBuf::from(config.gcc_path.as_ref().expect("libgccjit should be set by this point"))
.join("libgccjit.so");
let libgccjit_in_sysroot_path = lib_path.join("libgccjit.so");
// First remove the file to be able to create the symlink even when the file already exists.
let _ = fs::remove_file(&libgccjit_in_sysroot_path);
create_dir(&lib_path)?;
symlink(libgccjit_path, libgccjit_in_sysroot_path)
.map_err(|error| format!("Cannot create symlink for libgccjit.so: {}", error))?;

let library_dir = start_dir.join("sysroot_src").join("library");
cleanup_sysroot_previous_build(&library_dir);

Expand Down Expand Up @@ -148,7 +161,7 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
run_command_with_output_and_env(&args, Some(&sysroot_dir), Some(&env))?;

// Copy files to sysroot
let sysroot_path = start_dir.join(format!("sysroot/lib/rustlib/{}/lib/", config.target_triple));
let sysroot_path = lib_path.join(format!("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);
Expand All @@ -175,13 +188,6 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
fn build_codegen(args: &mut BuildArg) -> Result<(), String> {
let mut env = HashMap::new();

let gcc_path =
args.config_info.gcc_path.clone().expect(
"The config module should have emitted an error if the GCC path wasn't provided",
);
env.insert("LD_LIBRARY_PATH".to_string(), gcc_path.clone());
env.insert("LIBRARY_PATH".to_string(), gcc_path);

if args.config_info.no_default_features {
env.insert("RUSTFLAGS".to_string(), "-Csymbol-mangling-version=v0".to_string());
}
Expand Down
13 changes: 0 additions & 13 deletions compiler/rustc_codegen_gcc/build_system/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,19 +429,6 @@ impl ConfigInfo {
// display metadata load errors
env.insert("RUSTC_LOG".to_string(), "warn".to_string());

let sysroot = current_dir
.join(get_sysroot_dir())
.join(format!("sysroot/lib/rustlib/{}/lib", self.target_triple));
let ld_library_path = format!(
"{target}:{sysroot}:{gcc_path}",
target = self.cargo_target_dir,
sysroot = sysroot.display(),
gcc_path = gcc_path,
);
env.insert("LIBRARY_PATH".to_string(), ld_library_path.clone());
env.insert("LD_LIBRARY_PATH".to_string(), ld_library_path.clone());
env.insert("DYLD_LIBRARY_PATH".to_string(), ld_library_path);

// NOTE: To avoid the -fno-inline errors, use /opt/gcc/bin/gcc instead of cc.
// To do so, add a symlink for cc to /opt/gcc/bin/gcc in our PATH.
// Another option would be to add the following Rust flag: -Clinker=/opt/gcc/bin/gcc
Expand Down
14 changes: 1 addition & 13 deletions compiler/rustc_codegen_gcc/build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,6 @@ fn cargo_tests(test_env: &Env, test_args: &TestArg) -> Result<(), String> {
// We don't want to pass things like `RUSTFLAGS`, since they contain the -Zcodegen-backend flag.
// That would force `cg_gcc` to *rebuild itself* and only then run tests, which is undesirable.
let mut env = HashMap::new();
env.insert(
"LD_LIBRARY_PATH".into(),
test_env.get("LD_LIBRARY_PATH").expect("LD_LIBRARY_PATH missing!").to_string(),
);
env.insert(
"LIBRARY_PATH".into(),
test_env.get("LIBRARY_PATH").expect("LIBRARY_PATH missing!").to_string(),
);
env.insert(
"CG_RUSTFLAGS".into(),
test_env.get("CG_RUSTFLAGS").map(|s| s.as_str()).unwrap_or("").to_string(),
Expand Down Expand Up @@ -1065,6 +1057,7 @@ where
&test_dir,
&"--compiletest-rustc-args",
&rustc_args,
&"--bypass-ignore-backends",
];

if run_ignored_tests {
Expand Down Expand Up @@ -1275,11 +1268,6 @@ pub fn run() -> Result<(), String> {

if !args.use_system_gcc {
args.config_info.setup_gcc_path()?;
let gcc_path = args.config_info.gcc_path.clone().expect(
"The config module should have emitted an error if the GCC path wasn't provided",
);
env.insert("LIBRARY_PATH".to_string(), gcc_path.clone());
env.insert("LD_LIBRARY_PATH".to_string(), gcc_path);
}

build_if_no_backend(&env, &args)?;
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_codegen_gcc/doc/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ be useful.
CG_RUSTFLAGS="-Clink-args=-save-temps -v" ../y.sh cargo build
```

### How to send arguments to GCC

The `-Cllvm-args` `rustc` flag is repurposed by `rustc_codegen_gcc` to pass arguments directly to the GCC backend. You can use it via the `CG_RUSTFLAGS` environment variable. For example, to pass a `-f` flag to GCC:

```
CG_RUSTFLAGS="-Cllvm-args=-fflag-name" ../y.sh cargo build
```

### How to see the personality functions in the asm dump

```
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 @@
28b84db392ac0a572f1a2a2a1317aa5f2bc742cb
0081ca6631abdfa02bf42bc85aaf507b8a0e6beb
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-11-04"
channel = "nightly-2025-11-24"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn inline_attr<'gcc, 'tcx>(
/// attributes.
pub fn from_fn_attrs<'gcc, 'tcx>(
cx: &CodegenCx<'gcc, 'tcx>,
#[cfg_attr(not(feature = "master"), allow(unused_variables))] func: Function<'gcc>,
#[cfg_attr(not(feature = "master"), expect(unused_variables))] func: Function<'gcc>,
instance: ty::Instance<'tcx>,
) {
let codegen_fn_attrs = cx.tcx.codegen_instance_attrs(instance.def);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_gcc/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ pub fn optimize_thin_module(
save_temp_bitcode(cgcx, &module, "thin-lto-after-pm");
}
}*/
// FIXME: switch to #[expect] when the clippy bug is fixed.
#[allow(clippy::let_and_return)]
module
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
variable.to_rvalue()
}

#[allow(dead_code)]
fn va_arg(&mut self, _list: RValue<'gcc>, _ty: Type<'gcc>) -> RValue<'gcc> {
unimplemented!();
}
Expand Down Expand Up @@ -2517,7 +2516,7 @@ impl ToGccComp for RealPredicate {
}

#[repr(C)]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
enum MemOrdering {
__ATOMIC_RELAXED,
__ATOMIC_CONSUME,
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_codegen_gcc/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
global_value
}

#[cfg_attr(not(feature = "master"), allow(unused_mut))]
fn codegen_static(&mut self, def_id: DefId) {
let attrs = self.tcx.codegen_fn_attrs(def_id);

Expand Down Expand Up @@ -162,7 +161,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
// TODO(antoyo)
}

#[cfg_attr(not(feature = "master"), allow(unused_variables))]
#[cfg_attr(not(feature = "master"), expect(unused_variables))]
pub fn add_used_function(&self, function: Function<'gcc>) {
#[cfg(feature = "master")]
function.add_attribute(FnAttribute::Used);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::abi::conv_to_fn_attribute;
use crate::callee::get_fn;
use crate::common::SignType;

#[cfg_attr(not(feature = "master"), allow(dead_code))]
#[cfg_attr(not(feature = "master"), expect(dead_code))]
pub struct CodegenCx<'gcc, 'tcx> {
/// A cache of converted ConstAllocs
pub const_cache: RefCell<HashMap<Allocation, RValue<'gcc>>>,
Expand Down Expand Up @@ -132,7 +132,7 @@ pub struct CodegenCx<'gcc, 'tcx> {
}

impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
context: &'gcc Context<'gcc>,
codegen_unit: &'tcx CodegenUnit<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
///
/// If there’s a value with the same name already declared, the function will
/// update the declaration and return existing Value instead.
#[allow(clippy::let_and_return)]
#[expect(clippy::let_and_return)]
fn declare_raw_fn<'gcc>(
cx: &CodegenCx<'gcc, '_>,
name: &str,
Expand Down
Loading
Loading