Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2026-09-14"
channel = "nightly-2026-09-18"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
2 changes: 1 addition & 1 deletion src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use rustc_abi::{ArmCall, CanonAbi, InterruptKind, X86Call};
use rustc_abi::{Reg, RegKind};
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug;
use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::LayoutOf;
#[cfg(feature = "master")]
use rustc_session::{Session, config};
use rustc_span::bug;
use rustc_target::callconv::{ArgAttributes, CastTarget, FnAbi, PassMode};
#[cfg(feature = "master")]
use rustc_target::spec::Arch;
Expand Down
2 changes: 1 addition & 1 deletion src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use gccjit::{Context, FunctionType, ToRValue, Type};
use rustc_ast::expand::allocator::{
AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, default_fn_name, global_fn_name,
};
use rustc_middle::bug;
use rustc_middle::ty::TyCtxt;
use rustc_span::bug;
use rustc_symbol_mangling::mangle_internal_symbol;

use crate::GccContext;
Expand Down
3 changes: 1 addition & 2 deletions src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ use rustc_codegen_ssa::traits::{
AsmBuilderMethods, AsmCodegenMethods, BaseTypeCodegenMethods, BuilderMethods,
GlobalAsmOperandRef, InlineAsmOperandRef,
};
use rustc_middle::bug;
use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar};
use rustc_middle::ty::Instance;
use rustc_middle::ty::layout::LayoutOf;
use rustc_span::{DUMMY_SP, Span};
use rustc_span::{DUMMY_SP, Span, bug};
use rustc_target::asm::*;

use crate::builder::Builder;
Expand Down
4 changes: 2 additions & 2 deletions src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub fn from_fn_attrs<'gcc, 'tcx>(
.target_features
.iter()
.map(|features| features.name.as_str())
.flat_map(|feat| to_gcc_features(cx.tcx.sess, feat).into_iter())
.flat_map(|feat| to_gcc_features(&cx.tcx.sess.target, feat).into_iter())
.chain(codegen_fn_attrs.instruction_set.iter().map(|x| match *x {
InstructionSetAttr::ArmA32 => "-thumb-mode", // FIXME(antoyo): support removing feature.
InstructionSetAttr::ArmT32 => "thumb-mode",
Expand All @@ -164,7 +164,7 @@ pub fn from_fn_attrs<'gcc, 'tcx>(

// FIXME(antoyo): cg_llvm adds global features to each function so that LTO keep them.
// Check if GCC requires the same.
let mut global_features = cx.tcx.global_backend_features(()).iter().map(|s| s.as_str());
let mut global_features = cx.tcx.sess.global_backend_features.iter().map(|s| s.as_str());
function_features.extend(&mut global_features);
if x86_interrupt {
// GCC does not preserve SSE, MMX, or x87 state in interrupt handlers and rejects
Expand Down
6 changes: 3 additions & 3 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_target::spec::SymbolVisibility;
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::gcc_util::new_context;
use crate::{GccContext, LockedTargetInfo, LtoMode, SyncContext};
use crate::{GccContext, LtoMode, SharedTargetInfo, SyncContext};

#[cfg(feature = "master")]
pub fn visibility_to_gcc(visibility: Visibility) -> gccjit::Visibility {
Expand Down Expand Up @@ -113,7 +113,7 @@ pub fn linkage_needs_weak_attribute(linkage: Linkage) -> bool {
pub fn compile_codegen_unit(
tcx: TyCtxt<'_>,
cgu_name: Symbol,
target_info: LockedTargetInfo,
target_info: SharedTargetInfo,
lto_supported: bool,
) -> (ModuleCodegen<GccContext>, u64) {
let prof_timer = tcx.prof.generic_activity("codegen_module");
Expand All @@ -136,7 +136,7 @@ pub fn compile_codegen_unit(
fn module_codegen(
tcx: TyCtxt<'_>,
cgu_name: Symbol,
target_info: LockedTargetInfo,
target_info: SharedTargetInfo,
lto_supported: bool,
) -> ModuleCodegen<GccContext> {
let cgu = tcx.codegen_unit(cgu_name);
Expand Down
3 changes: 1 addition & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ use rustc_codegen_ssa::traits::{
LayoutTypeCodegenMethods, OverflowOp, ReturnSlot, StaticBuilderMethods,
};
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
use rustc_middle::ty::layout::{
FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTyCtxt, HasTypingEnv, LayoutError,
LayoutOfHelpers, TyAndLayout,
};
use rustc_middle::ty::{self, AtomicOrdering, Instance, Ty, TyCtxt};
use rustc_span::Span;
use rustc_span::def_id::DefId;
use rustc_span::{Span, bug};
use rustc_target::callconv::FnAbi;
use rustc_target::spec::{HasTargetSpec, HasX86AbiOpt, Target, X86Abi};

Expand Down
2 changes: 1 addition & 1 deletion src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use rustc_middle::mir::interpret::{
use rustc_middle::mono::MonoItem;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Instance};
use rustc_middle::{bug, span_bug};
use rustc_span::def_id::DefId;
use rustc_span::{bug, span_bug};

use crate::common::bytes_type_in_context;
use crate::context::CodegenCx;
Expand Down
4 changes: 2 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ impl<'gcc, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
}
let tcx = self.tcx;
let func = match tcx.lang_items().eh_personality() {
Some(def_id) if !wants_msvc_seh(self.sess()) => {
Some(def_id) if !wants_msvc_seh(&self.sess().target) => {
let instance = ty::Instance::expect_resolve(
tcx,
self.typing_env(),
Expand All @@ -513,7 +513,7 @@ impl<'gcc, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
self.declare_fn(symbol_name, fn_abi)
}
_ => {
let name = if wants_msvc_seh(self.sess()) {
let name = if wants_msvc_seh(&self.sess().target) {
"__CxxFrameHandler3"
} else {
"rust_eh_personality"
Expand Down
18 changes: 9 additions & 9 deletions src/gcc_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ use gccjit::Context;
use gccjit::Version;
use rustc_codegen_ssa::target_features;
use rustc_data_structures::smallvec::{SmallVec, smallvec};
use rustc_session::Session;
use rustc_session::config::NATIVE_CPU;
use rustc_target::spec::{Arch, RelocModel, StackProbeType, StackProtector};
use rustc_session::{EarlySession, Session};
use rustc_target::spec::{Arch, RelocModel, StackProbeType, StackProtector, Target};

fn gcc_features_by_flags(sess: &Session, features: &mut Vec<String>) {
fn gcc_features_by_flags(sess: &EarlySession, features: &mut Vec<String>) {
target_features::retpoline_features_by_flags(sess, features);
// FIXME: LLVM also sets +reserve-x18 here under some conditions.
}

/// The list of GCC features computed from CLI flags (`-Ctarget-cpu`, `-Ctarget-feature`,
/// `--target` and similar).
pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
pub(crate) fn global_gcc_features(sess: &EarlySession) -> Vec<String> {
// Features that come earlier are overridden by conflicting features later in the string.
// Typically we'll want more explicit settings to override the implicit ones, so:
//
Expand All @@ -45,9 +45,9 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
// features also work on the command line instead of having two
// different names when the GCC name and the Rust name differ.
features.extend(
to_gcc_features(sess, feature)
to_gcc_features(&sess.target, feature)
.iter()
.flat_map(|feat| to_gcc_features(sess, feat).into_iter())
.flat_map(|feat| to_gcc_features(&sess.target, feat).into_iter())
.map(|feature| if !enable { format!("-{}", feature) } else { feature.to_string() }),
);
};
Expand All @@ -64,9 +64,9 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
}

// To find a list of GCC's names, check https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
pub fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> {
pub fn to_gcc_features<'a>(target: &Target, s: &'a str) -> SmallVec<[&'a str; 2]> {
// cSpell:disable
match (&sess.target.arch, s) {
match (&target.arch, s) {
// FIXME: seems like x87 does not exist?
(&Arch::X86 | &Arch::X86_64, "x87") => smallvec![],
(&Arch::X86 | &Arch::X86_64, "sse4.2") => smallvec!["sse4.2", "crc32"],
Expand Down Expand Up @@ -139,7 +139,7 @@ fn handle_native(name: &str) -> Cow<'_, str> {
unimplemented!();
}

pub fn target_cpu(sess: &Session) -> Cow<'_, str> {
pub fn target_cpu(sess: &EarlySession) -> Cow<'_, str> {
match sess.opts.cg.target_cpu {
Some(ref name) => handle_native(name),
None => handle_native(sess.target.cpu.as_ref()),
Expand Down
5 changes: 2 additions & 3 deletions src/intrinsic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_middle::ty::layout::FnAbiOf;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Instance, Ty};
use rustc_middle::{bug, span_bug};
use rustc_session::config::OptLevel;
use rustc_span::{Span, Symbol, sym};
use rustc_span::{Span, Symbol, bug, span_bug, sym};
use rustc_target::callconv::{ArgAbi, PassMode};

#[cfg(feature = "master")]
Expand Down Expand Up @@ -1371,7 +1370,7 @@ fn try_intrinsic<'a, 'b, 'gcc, 'tcx>(
// we can never unwind.
OperandValue::Immediate(bx.const_bool(false)).store(bx, dest);
} else {
if wants_msvc_seh(bx.sess()) {
if wants_msvc_seh(&bx.sess().target) {
unimplemented!();
}
#[cfg(feature = "master")]
Expand Down
3 changes: 1 addition & 2 deletions src/intrinsic/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, LayoutTy
#[cfg(feature = "master")]
use rustc_hir as hir;
use rustc_middle::mir::BinOp;
use rustc_middle::span_bug;
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
use rustc_middle::ty::{self, Ty};
use rustc_span::{ErrorGuaranteed, Span, Symbol, sym};
use rustc_span::{ErrorGuaranteed, Span, Symbol, span_bug, sym};

use crate::builder::Builder;
#[cfg(not(feature = "master"))]
Expand Down
Loading
Loading