about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/lib.rs
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-05-30 11:55:06 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-06-03 10:04:34 +0000
commitbadabab01f15f156dbb6ce39df4a339006fbfae1 (patch)
treefec9ba97cb1f0d7770f52316dfcab95e8bac589f /compiler/rustc_codegen_llvm/src/lib.rs
parentc68032fd4c442d275f4daa571ba19c076106b490 (diff)
downloadrust-badabab01f15f156dbb6ce39df4a339006fbfae1.tar.gz
rust-badabab01f15f156dbb6ce39df4a339006fbfae1.zip
Only borrow EncodedMetadata in codegen_crate
And move passing it to the linker to the driver code.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/lib.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/lib.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs
index fd376ea8d80..0ef2761a66a 100644
--- a/compiler/rustc_codegen_llvm/src/lib.rs
+++ b/compiler/rustc_codegen_llvm/src/lib.rs
@@ -344,15 +344,13 @@ impl CodegenBackend for LlvmCodegenBackend {
     fn codegen_crate<'tcx>(
         &self,
         tcx: TyCtxt<'tcx>,
-        metadata: EncodedMetadata,
-        need_metadata_module: bool,
+        metadata: Option<&EncodedMetadata>,
     ) -> Box<dyn Any> {
         Box::new(rustc_codegen_ssa::base::codegen_crate(
             LlvmCodegenBackend(()),
             tcx,
             crate::llvm_util::target_cpu(tcx.sess).to_string(),
             metadata,
-            need_metadata_module,
         ))
     }
 
@@ -377,14 +375,20 @@ impl CodegenBackend for LlvmCodegenBackend {
         (codegen_results, work_products)
     }
 
-    fn link(&self, sess: &Session, codegen_results: CodegenResults, outputs: &OutputFilenames) {
+    fn link(
+        &self,
+        sess: &Session,
+        codegen_results: CodegenResults,
+        metadata: EncodedMetadata,
+        outputs: &OutputFilenames,
+    ) {
         use rustc_codegen_ssa::back::link::link_binary;
 
         use crate::back::archive::LlvmArchiveBuilderBuilder;
 
         // Run the linker on any artifacts that resulted from the LLVM run.
         // This should produce either a finished executable or library.
-        link_binary(sess, &LlvmArchiveBuilderBuilder, codegen_results, outputs);
+        link_binary(sess, &LlvmArchiveBuilderBuilder, codegen_results, metadata, outputs);
     }
 }