1
Fork 0

Rollup merge of #79662 - bjorn3:move_more_code_out_of_codegen_backend, r=oli-obk

Move some more code out of CodegenBackend::{codegen_crate,link}

Kind of a follow up to #77795
This commit is contained in:
Dylan DPC 2020-12-28 14:12:59 +01:00 committed by GitHub
commit 98d80bda01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 34 deletions

View file

@ -298,21 +298,19 @@ impl CodegenBackend for LlvmCodegenBackend {
codegen_results: CodegenResults,
outputs: &OutputFilenames,
) -> Result<(), ErrorReported> {
use crate::back::archive::LlvmArchiveBuilder;
use rustc_codegen_ssa::back::link::link_binary;
// Run the linker on any artifacts that resulted from the LLVM run.
// This should produce either a finished executable or library.
sess.time("link_crate", || {
use crate::back::archive::LlvmArchiveBuilder;
use rustc_codegen_ssa::back::link::link_binary;
let target_cpu = crate::llvm_util::target_cpu(sess);
link_binary::<LlvmArchiveBuilder<'_>>(
sess,
&codegen_results,
outputs,
&codegen_results.crate_name.as_str(),
target_cpu,
);
});
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(())
}