Skip to content

Commit 94a4a4c

Browse files
Convert llvm-arg --x86-asm-syntax into GCC arg -masm
1 parent d04e66f commit 94a4a4c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/base.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ 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+
let syntax = arg.splitn(2, '=').skip(1).next().expect("missing argument");
118+
context.add_command_line_option(&format!("-masm={}", syntax));
119+
} else {
120+
context.add_command_line_option(arg);
121+
}
116122
}
117123
// NOTE: This is needed to compile the file src/intrinsic/archs.rs during a bootstrap of rustc.
118124
context.add_command_line_option("-fno-var-tracking-assignments");

0 commit comments

Comments
 (0)