Revert changes in argument parsing for setting asm syntax

This commit is contained in:
Guillaume Gomez 2022-10-26 17:04:58 +02:00
parent 78f960be32
commit bf3ef4ce1a

View File

@ -87,6 +87,8 @@ fn module_codegen(tcx: TyCtxt<'_>, (cgu_name, supports_128bit_integers): (Symbol
// Instantiate monomorphizations without filling out definitions yet... // Instantiate monomorphizations without filling out definitions yet...
//let llvm_module = ModuleLlvm::new(tcx, &cgu_name.as_str()); //let llvm_module = ModuleLlvm::new(tcx, &cgu_name.as_str());
let context = Context::default(); let context = Context::default();
// TODO(antoyo): only set on x86 platforms.
context.add_command_line_option("-masm=intel");
// TODO(antoyo): only add the following cli argument if the feature is supported. // TODO(antoyo): only add the following cli argument if the feature is supported.
context.add_command_line_option("-msse2"); context.add_command_line_option("-msse2");
context.add_command_line_option("-mavx2"); context.add_command_line_option("-mavx2");
@ -109,20 +111,8 @@ fn module_codegen(tcx: TyCtxt<'_>, (cgu_name, supports_128bit_integers): (Symbol
context.add_command_line_option("-mvpclmulqdq"); context.add_command_line_option("-mvpclmulqdq");
context.add_command_line_option("-mavx"); context.add_command_line_option("-mavx");
let mut has_set_asm_syntax = false;
for arg in &tcx.sess.opts.cg.llvm_args { for arg in &tcx.sess.opts.cg.llvm_args {
if arg.starts_with("--x86-asm-syntax=") { context.add_command_line_option(arg);
// LLVM uses the two same arguments as GCC: `att` and `intel`.
let syntax = arg.splitn(2, '=').skip(1).next().expect("missing argument");
context.add_command_line_option(&format!("-masm={}", syntax));
has_set_asm_syntax = true;
} else {
context.add_command_line_option(arg);
}
}
if !has_set_asm_syntax {
// TODO(antoyo): only set on x86 platforms.
context.add_command_line_option("-masm=intel");
} }
// NOTE: This is needed to compile the file src/intrinsic/archs.rs during a bootstrap of rustc. // NOTE: This is needed to compile the file src/intrinsic/archs.rs during a bootstrap of rustc.
context.add_command_line_option("-fno-var-tracking-assignments"); context.add_command_line_option("-fno-var-tracking-assignments");