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.
This commit is contained in:
bjorn3
2025-05-30 12:51:15 +00:00
parent badabab01f
commit 0bd7aa1116
17 changed files with 92 additions and 220 deletions

View File

@@ -341,16 +341,11 @@ impl CodegenBackend for LlvmCodegenBackend {
target_config(sess)
}
fn codegen_crate<'tcx>(
&self,
tcx: TyCtxt<'tcx>,
metadata: Option<&EncodedMetadata>,
) -> Box<dyn Any> {
fn codegen_crate<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Box<dyn Any> {
Box::new(rustc_codegen_ssa::base::codegen_crate(
LlvmCodegenBackend(()),
tcx,
crate::llvm_util::target_cpu(tcx.sess).to_string(),
metadata,
))
}