Pass target_cpu to LinkerInfo::new instead of link_binary

This is one step towards separating the linking code from codegen backends
This commit is contained in:
bjorn3 2021-03-28 22:14:09 +02:00
parent 673c1b6e49
commit 808090eb07
7 changed files with 26 additions and 40 deletions

View file

@ -270,6 +270,7 @@ impl CodegenBackend for LlvmCodegenBackend {
Box::new(rustc_codegen_ssa::base::codegen_crate(
LlvmCodegenBackend(()),
tcx,
crate::llvm_util::target_cpu(tcx.sess).to_string(),
metadata,
need_metadata_module,
))
@ -305,13 +306,11 @@ impl CodegenBackend for LlvmCodegenBackend {
// Run the linker on any artifacts that resulted from the LLVM run.
// This should produce either a finished executable or library.
let target_cpu = crate::llvm_util::target_cpu(sess);
link_binary::<LlvmArchiveBuilder<'_>>(
sess,
&codegen_results,
outputs,
&codegen_results.crate_name.as_str(),
target_cpu,
);
Ok(())