diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-06-15 23:51:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 23:51:54 +0200 |
| commit | 0b249d3f857b86887bae595d32b4c40235a32bf0 (patch) | |
| tree | 24aa340ff1069b6a2f0158a7f63d03c2b66aae99 /compiler/rustc_interface/src/queries.rs | |
| parent | b79d3b1ec15c64bf00677207287b17e3d6f6e05f (diff) | |
| parent | 0bd7aa1116c42a96d1c692065ae500a3d2d75484 (diff) | |
| download | rust-0b249d3f857b86887bae595d32b4c40235a32bf0.tar.gz rust-0b249d3f857b86887bae595d32b4c40235a32bf0.zip | |
Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=workingjubilee,saethlin
Move metadata object generation for dylibs to the linker code This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time. Prerequisite of https://github.com/rust-lang/rust/issues/96708.
Diffstat (limited to 'compiler/rustc_interface/src/queries.rs')
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index c8914c9be9c..9a474b910f6 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -5,6 +5,7 @@ use rustc_codegen_ssa::CodegenResults; use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::svh::Svh; use rustc_hir::def_id::LOCAL_CRATE; +use rustc_metadata::EncodedMetadata; use rustc_middle::dep_graph::DepGraph; use rustc_middle::ty::TyCtxt; use rustc_session::Session; @@ -18,6 +19,7 @@ pub struct Linker { output_filenames: Arc<OutputFilenames>, // Only present when incr. comp. is enabled. crate_hash: Option<Svh>, + metadata: EncodedMetadata, ongoing_codegen: Box<dyn Any>, } @@ -26,7 +28,7 @@ impl Linker { tcx: TyCtxt<'_>, codegen_backend: &dyn CodegenBackend, ) -> Linker { - let ongoing_codegen = passes::start_codegen(codegen_backend, tcx); + let (ongoing_codegen, metadata) = passes::start_codegen(codegen_backend, tcx); Linker { dep_graph: tcx.dep_graph.clone(), @@ -36,6 +38,7 @@ impl Linker { } else { None }, + metadata, ongoing_codegen, } } @@ -75,6 +78,7 @@ impl Linker { sess, &rlink_file, &codegen_results, + &self.metadata, &*self.output_filenames, ) .unwrap_or_else(|error| { @@ -84,6 +88,6 @@ impl Linker { } let _timer = sess.prof.verbose_generic_activity("link_crate"); - codegen_backend.link(sess, codegen_results, &self.output_filenames) + codegen_backend.link(sess, codegen_results, self.metadata, &self.output_filenames) } } |
