@@ -87,8 +87,6 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_
87
87
// Instantiate monomorphizations without filling out definitions yet...
88
88
//let llvm_module = ModuleLlvm::new(tcx, &cgu_name.as_str());
89
89
let context = Context :: default ( ) ;
90
- // TODO(antoyo): only set on x86 platforms.
91
- context. add_command_line_option ( "-masm=intel" ) ;
92
90
// TODO(antoyo): only add the following cli argument if the feature is supported.
93
91
context. add_command_line_option ( "-msse2" ) ;
94
92
context. add_command_line_option ( "-mavx2" ) ;
@@ -111,15 +109,21 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_
111
109
context. add_command_line_option ( "-mvpclmulqdq" ) ;
112
110
context. add_command_line_option ( "-mavx" ) ;
113
111
112
+ let mut has_set_asm_syntax = false ;
114
113
for arg in & tcx. sess . opts . cg . llvm_args {
115
114
if arg. starts_with ( "--x86-asm-syntax=" ) {
116
115
// LLVM uses the two same arguments as GCC: `att` and `intel`.
117
116
let syntax = arg. splitn ( 2 , '=' ) . skip ( 1 ) . next ( ) . expect ( "missing argument" ) ;
118
117
context. add_command_line_option ( & format ! ( "-masm={}" , syntax) ) ;
118
+ has_set_asm_syntax = true ;
119
119
} else {
120
120
context. add_command_line_option ( arg) ;
121
121
}
122
122
}
123
+ if !has_set_asm_syntax {
124
+ // TODO(antoyo): only set on x86 platforms.
125
+ context. add_command_line_option ( "-masm=intel" ) ;
126
+ }
123
127
// NOTE: This is needed to compile the file src/intrinsic/archs.rs during a bootstrap of rustc.
124
128
context. add_command_line_option ( "-fno-var-tracking-assignments" ) ;
125
129
// NOTE: an optimization (https://github.com/rust-lang/rustc_codegen_gcc/issues/53).
0 commit comments