Skip to content

Commit 1001a71

Browse files
Convert llvm-arg --x86-asm-syntax into GCC arg -masm
1 parent ad48add commit 1001a71

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/base.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,14 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_
112112
context.add_command_line_option("-mavx");
113113

114114
for arg in &tcx.sess.opts.cg.llvm_args {
115-
context.add_command_line_option(arg);
115+
if arg.starts_with("--x86-asm-syntax=") {
116+
// LLVM uses the two same arguments as GCC: `att` and `intel`.
117+
if let Some(syntax) = arg.splitn(2, '=').skip(1).next() {
118+
context.add_command_line_option(&format!("-masm={}", syntax));
119+
}
120+
} else {
121+
context.add_command_line_option(arg);
122+
}
116123
}
117124
// NOTE: This is needed to compile the file src/intrinsic/archs.rs during a bootstrap of rustc.
118125
context.add_command_line_option("-fno-var-tracking-assignments");

0 commit comments

Comments
 (0)