Skip to content

Commit 80340cd

Browse files
authored
Merge pull request #763 from rust-lang/sync_from_rust_2025_09_29
Sync from rust 2025/09/30
2 parents 346f79b + a2b536a commit 80340cd

File tree

7 files changed

+34
-21
lines changed

7 files changed

+34
-21
lines changed

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2025-09-16"
2+
channel = "nightly-2025-09-30"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/asm.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,12 @@ fn reg_class_to_gcc(reg_class: InlineAsmRegClass) -> &'static str {
698698
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::reg_nonzero) => "b",
699699
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::freg) => "f",
700700
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => "v",
701-
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::cr)
702-
| InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::xer) => {
701+
InlineAsmRegClass::PowerPC(
702+
PowerPCInlineAsmRegClass::cr
703+
| PowerPCInlineAsmRegClass::ctr
704+
| PowerPCInlineAsmRegClass::lr
705+
| PowerPCInlineAsmRegClass::xer,
706+
) => {
703707
unreachable!("clobber-only")
704708
}
705709
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => "r",
@@ -777,8 +781,12 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
777781
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::vreg) => {
778782
cx.type_vector(cx.type_i32(), 4)
779783
}
780-
InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::cr)
781-
| InlineAsmRegClass::PowerPC(PowerPCInlineAsmRegClass::xer) => {
784+
InlineAsmRegClass::PowerPC(
785+
PowerPCInlineAsmRegClass::cr
786+
| PowerPCInlineAsmRegClass::ctr
787+
| PowerPCInlineAsmRegClass::lr
788+
| PowerPCInlineAsmRegClass::xer,
789+
) => {
782790
unreachable!("clobber-only")
783791
}
784792
InlineAsmRegClass::RiscV(RiscVInlineAsmRegClass::reg) => cx.type_i32(),

src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use rustc_middle::mir::mono::Visibility;
1515
use rustc_middle::ty::TyCtxt;
1616
use rustc_session::config::DebugInfo;
1717
use rustc_span::Symbol;
18+
use rustc_target::spec::RelocModel;
1819
#[cfg(feature = "master")]
1920
use rustc_target::spec::SymbolVisibility;
20-
use rustc_target::spec::{PanicStrategy, RelocModel};
2121

2222
use crate::builder::Builder;
2323
use crate::context::CodegenCx;
@@ -101,7 +101,7 @@ pub fn compile_codegen_unit(
101101
// Instantiate monomorphizations without filling out definitions yet...
102102
let context = new_context(tcx);
103103

104-
if tcx.sess.panic_strategy() == PanicStrategy::Unwind {
104+
if tcx.sess.panic_strategy().unwinds() {
105105
context.add_command_line_option("-fexceptions");
106106
context.add_driver_option("-fexceptions");
107107
}

src/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
13831383
_src_align: Align,
13841384
size: RValue<'gcc>,
13851385
flags: MemFlags,
1386+
_tt: Option<rustc_ast::expand::typetree::FncTree>, // Autodiff TypeTrees are LLVM-only, ignored in GCC backend
13861387
) {
13871388
assert!(!flags.contains(MemFlags::NONTEMPORAL), "non-temporal memcpy not supported");
13881389
let size = self.intcast(size, self.type_size_t(), false);

src/context.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
147147
let layout = tcx
148148
.layout_of(ty::TypingEnv::fully_monomorphized().as_query_input(rust_type))
149149
.unwrap();
150-
let align = layout.align.abi.bytes();
150+
let align = layout.align.bytes();
151151
// For types with size 1, the alignment can be 1 and only 1
152152
// So, we can skip the call to ``get_aligned`.
153153
// In the future, we can add a GCC API to query the type align,
@@ -186,9 +186,9 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
186186
(i128_type, u128_type)
187187
} else {
188188
/*let layout = tcx.layout_of(ParamEnv::reveal_all().and(tcx.types.i128)).unwrap();
189-
let i128_align = layout.align.abi.bytes();
189+
let i128_align = layout.align.bytes();
190190
let layout = tcx.layout_of(ParamEnv::reveal_all().and(tcx.types.u128)).unwrap();
191-
let u128_align = layout.align.abi.bytes();*/
191+
let u128_align = layout.align.bytes();*/
192192

193193
// TODO(antoyo): re-enable the alignment when libgccjit fixed the issue in
194194
// gcc_jit_context_new_array_constructor (it should not use reinterpret_cast).
@@ -529,7 +529,10 @@ impl<'gcc, 'tcx> HasX86AbiOpt for CodegenCx<'gcc, 'tcx> {
529529
impl<'gcc, 'tcx> LayoutOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
530530
#[inline]
531531
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
532-
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
532+
if let LayoutError::SizeOverflow(_)
533+
| LayoutError::InvalidSimd { .. }
534+
| LayoutError::ReferencesError(_) = err
535+
{
533536
self.tcx.dcx().emit_fatal(respan(span, err.into_diagnostic()))
534537
} else {
535538
self.tcx.dcx().emit_fatal(ssa_errors::FailedToGetLayout { span, ty, err })
@@ -545,7 +548,9 @@ impl<'gcc, 'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'gcc, 'tcx> {
545548
span: Span,
546549
fn_abi_request: FnAbiRequest<'tcx>,
547550
) -> ! {
548-
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
551+
if let FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::InvalidSimd { .. }) =
552+
err
553+
{
549554
self.tcx.dcx().emit_fatal(respan(span, err))
550555
} else {
551556
match fn_abi_request {

src/intrinsic/mod.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use rustc_middle::ty::layout::LayoutOf;
2929
use rustc_middle::ty::{self, Instance, Ty};
3030
use rustc_span::{Span, Symbol, sym};
3131
use rustc_target::callconv::{ArgAbi, PassMode};
32-
use rustc_target::spec::PanicStrategy;
3332

3433
#[cfg(feature = "master")]
3534
use crate::abi::FnAbiGccExt;
@@ -694,7 +693,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
694693
if self.is_sized_indirect() {
695694
OperandValue::Ref(PlaceValue::new_sized(val, self.layout.align.abi)).store(bx, dst)
696695
} else if self.is_unsized_indirect() {
697-
bug!("unsized `ArgAbi` must be handled through `store_fn_arg`");
696+
bug!("unsized `ArgAbi` cannot be stored");
698697
} else if let PassMode::Cast { ref cast, .. } = self.mode {
699698
// FIXME(eddyb): Figure out when the simpler Store is safe, clang
700699
// uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
@@ -735,6 +734,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
735734
scratch_align,
736735
bx.const_usize(self.layout.size.bytes()),
737736
MemFlags::empty(),
737+
None,
738738
);
739739

740740
bx.lifetime_end(scratch, scratch_size);
@@ -761,12 +761,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
761761
OperandValue::Pair(next(), next()).store(bx, dst);
762762
}
763763
PassMode::Indirect { meta_attrs: Some(_), .. } => {
764-
let place_val = PlaceValue {
765-
llval: next(),
766-
llextra: Some(next()),
767-
align: self.layout.align.abi,
768-
};
769-
OperandValue::Ref(place_val).store(bx, dst);
764+
bug!("unsized `ArgAbi` cannot be stored");
770765
}
771766
PassMode::Direct(_)
772767
| PassMode::Indirect { meta_attrs: None, .. }
@@ -1303,7 +1298,7 @@ fn try_intrinsic<'a, 'b, 'gcc, 'tcx>(
13031298
_catch_func: RValue<'gcc>,
13041299
dest: PlaceRef<'tcx, RValue<'gcc>>,
13051300
) {
1306-
if bx.sess().panic_strategy() == PanicStrategy::Abort {
1301+
if !bx.sess().panic_strategy().unwinds() {
13071302
bx.call(bx.type_void(), None, None, try_func, &[data], None, None);
13081303
// Return 0 unconditionally from the intrinsic call;
13091304
// we can never unwind.

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ impl CodegenBackend for GccCodegenBackend {
184184
crate::DEFAULT_LOCALE_RESOURCE
185185
}
186186

187+
fn name(&self) -> &'static str {
188+
"gcc"
189+
}
190+
187191
fn init(&self, _sess: &Session) {
188192
#[cfg(feature = "master")]
189193
{

0 commit comments

Comments
 (0)