Skip to content

Commit 059d3b3

Browse files
committed
rustc_codegen_gcc: error on unwinding inline asm
1 parent e33a3f9 commit 059d3b3

File tree

1 file changed

+8
-1
lines changed
  • compiler/rustc_codegen_gcc/src

1 file changed

+8
-1
lines changed

compiler/rustc_codegen_gcc/src/asm.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,14 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
118118
true
119119
}
120120

121-
fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, _span: &[Span], _instance: Instance<'_>) {
121+
fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], _instance: Instance<'_>, dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) {
122+
if dest_catch_funclet.is_some() {
123+
self.sess()
124+
.struct_span_err(span[0], "GCC backend does not support unwinding from inline asm")
125+
.emit();
126+
return;
127+
}
128+
122129
let asm_arch = self.tcx.sess.asm_arch.unwrap();
123130
let is_x86 = matches!(asm_arch, InlineAsmArch::X86 | InlineAsmArch::X86_64);
124131
let att_dialect = is_x86 && options.contains(InlineAsmOptions::ATT_SYNTAX);

0 commit comments

Comments
 (0)