Skip to content
Closed
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
14 changes: 14 additions & 0 deletions compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::llvm;
use crate::llvm_util;
use crate::type_::Type;
use crate::type_of::LayoutLlvmExt;
use crate::value::Value;
Expand Down Expand Up @@ -120,6 +121,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
operands: &[InlineAsmOperandRef<'tcx, Self>],
options: InlineAsmOptions,
line_spans: &[Span],
span: Span,
) {
let asm_arch = self.tcx.sess.asm_arch.unwrap();

Expand Down Expand Up @@ -281,6 +283,18 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
InlineAsmArch::X86 | InlineAsmArch::X86_64
if !options.contains(InlineAsmOptions::ATT_SYNTAX) =>
{
if llvm_util::get_version() < (10, 0, 1) {
let mut err = self.sess().struct_span_err(
span,
"Intel syntax inline assembly requires LLVM 10.0.1 or later",
);
err.help("Consider using AT&T syntax instead with the att_syntax option");
err.emit();

// We still emit the LLVM IR, but that's fine since we stop
// before reaching LLVM codegen which actually tries to
// parse the asm constraint codes.
}
LlvmAsmDialect::Intel
}
_ => LlvmAsmDialect::Att,
Expand Down
8 changes: 7 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
})
.collect();

bx.codegen_inline_asm(template, &operands, options, line_spans);
bx.codegen_inline_asm(
template,
&operands,
options,
line_spans,
terminator.source_info.span,
);

if let Some(target) = destination {
helper.funclet_br(self, &mut bx, target);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/traits/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub trait AsmBuilderMethods<'tcx>: BackendTypes {
operands: &[InlineAsmOperandRef<'tcx, Self>],
options: InlineAsmOptions,
line_spans: &[Span],
span: Span,
);
}

Expand Down