mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Pass owned CodegenResults to link_binary
After link_binary the temporary files referenced by CodegenResults are deleted, so calling link_binary again with the same CodegenResults should not be allowed.
This commit is contained in:
parent
cb44c0c8b6
commit
0a619dbc5d
@ -382,7 +382,7 @@ impl CodegenBackend for LlvmCodegenBackend {
|
|||||||
|
|
||||||
// Run the linker on any artifacts that resulted from the LLVM run.
|
// Run the linker on any artifacts that resulted from the LLVM run.
|
||||||
// This should produce either a finished executable or library.
|
// This should produce either a finished executable or library.
|
||||||
link_binary(sess, &LlvmArchiveBuilderBuilder, &codegen_results, outputs)
|
link_binary(sess, &LlvmArchiveBuilderBuilder, codegen_results, outputs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ pub fn ensure_removed(dcx: DiagCtxtHandle<'_>, path: &Path) {
|
|||||||
pub fn link_binary(
|
pub fn link_binary(
|
||||||
sess: &Session,
|
sess: &Session,
|
||||||
archive_builder_builder: &dyn ArchiveBuilderBuilder,
|
archive_builder_builder: &dyn ArchiveBuilderBuilder,
|
||||||
codegen_results: &CodegenResults,
|
codegen_results: CodegenResults,
|
||||||
outputs: &OutputFilenames,
|
outputs: &OutputFilenames,
|
||||||
) -> Result<(), ErrorGuaranteed> {
|
) -> Result<(), ErrorGuaranteed> {
|
||||||
let _timer = sess.timer("link_binary");
|
let _timer = sess.timer("link_binary");
|
||||||
@ -116,7 +116,7 @@ pub fn link_binary(
|
|||||||
link_rlib(
|
link_rlib(
|
||||||
sess,
|
sess,
|
||||||
archive_builder_builder,
|
archive_builder_builder,
|
||||||
codegen_results,
|
&codegen_results,
|
||||||
RlibFlavor::Normal,
|
RlibFlavor::Normal,
|
||||||
&path,
|
&path,
|
||||||
)?
|
)?
|
||||||
@ -126,7 +126,7 @@ pub fn link_binary(
|
|||||||
link_staticlib(
|
link_staticlib(
|
||||||
sess,
|
sess,
|
||||||
archive_builder_builder,
|
archive_builder_builder,
|
||||||
codegen_results,
|
&codegen_results,
|
||||||
&out_filename,
|
&out_filename,
|
||||||
&path,
|
&path,
|
||||||
)?;
|
)?;
|
||||||
@ -137,7 +137,7 @@ pub fn link_binary(
|
|||||||
archive_builder_builder,
|
archive_builder_builder,
|
||||||
crate_type,
|
crate_type,
|
||||||
&out_filename,
|
&out_filename,
|
||||||
codegen_results,
|
&codegen_results,
|
||||||
path.as_ref(),
|
path.as_ref(),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ pub trait CodegenBackend {
|
|||||||
codegen_results: CodegenResults,
|
codegen_results: CodegenResults,
|
||||||
outputs: &OutputFilenames,
|
outputs: &OutputFilenames,
|
||||||
) -> Result<(), ErrorGuaranteed> {
|
) -> Result<(), ErrorGuaranteed> {
|
||||||
link_binary(sess, &ArArchiveBuilderBuilder, &codegen_results, outputs)
|
link_binary(sess, &ArArchiveBuilderBuilder, codegen_results, outputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this backend can be safely called from multiple threads.
|
/// Returns `true` if this backend can be safely called from multiple threads.
|
||||||
|
Loading…
Reference in New Issue
Block a user