diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index 6536a7937f..c2398d3f94 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -230,8 +230,16 @@ impl MetadataLoader for SpirvMetadataLoader { link::read_metadata(path) } - fn get_dylib_metadata(&self, _: &Target, _: &Path) -> Result { - Err("TODO: implement get_dylib_metadata".to_string()) + fn get_dylib_metadata(&self, target: &Target, path: &Path) -> Result { + // HACK(eddyb) this is needed to allow metadata loading for proc macros + // (compiled as host dylibs); perhaps it'd be better to use the `object` + // crate, like `rustc_codegen_cranelift` does. + // NOTE(eddyb) while both `::new()` and `.metadata_loader()` call `Box::new`, + // they only do so with ZST values, and so we don't pointlessly allocate. + extern crate rustc_codegen_llvm; + rustc_codegen_llvm::LlvmCodegenBackend::new() + .metadata_loader() + .get_dylib_metadata(target, path) } }