@@ -7,7 +7,7 @@ use std::{env, thread};
77
88use rustc_ast as ast;
99use rustc_attr_parsing:: { ShouldEmit , validate_attr} ;
10- use rustc_codegen_ssa:: back:: archive:: ArArchiveBuilderBuilder ;
10+ use rustc_codegen_ssa:: back:: archive:: { ArArchiveBuilderBuilder , ArchiveBuilderBuilder } ;
1111use rustc_codegen_ssa:: back:: link:: link_binary;
1212use rustc_codegen_ssa:: target_features:: { self , cfg_target_feature} ;
1313use rustc_codegen_ssa:: traits:: CodegenBackend ;
@@ -440,7 +440,7 @@ impl CodegenBackend for DummyCodegenBackend {
440440
441441 link_binary (
442442 sess,
443- & ArArchiveBuilderBuilder ,
443+ & DummyArchiveBuilderBuilder ,
444444 codegen_results,
445445 metadata,
446446 outputs,
@@ -449,6 +449,28 @@ impl CodegenBackend for DummyCodegenBackend {
449449 }
450450}
451451
452+ struct DummyArchiveBuilderBuilder ;
453+
454+ impl ArchiveBuilderBuilder for DummyArchiveBuilderBuilder {
455+ fn new_archive_builder < ' a > (
456+ & self ,
457+ sess : & ' a Session ,
458+ ) -> Box < dyn rustc_codegen_ssa:: back:: archive:: ArchiveBuilder + ' a > {
459+ ArArchiveBuilderBuilder . new_archive_builder ( sess)
460+ }
461+
462+ fn create_dll_import_lib (
463+ & self ,
464+ sess : & Session ,
465+ _lib_name : & str ,
466+ _items : Vec < rustc_codegen_ssa:: back:: archive:: ImportLibraryItem > ,
467+ output_path : & Path ,
468+ ) {
469+ // Build an empty static library to avoid calling an external dlltool on mingw
470+ ArArchiveBuilderBuilder . new_archive_builder ( sess) . build ( output_path) ;
471+ }
472+ }
473+
452474// This is used for rustdoc, but it uses similar machinery to codegen backend
453475// loading, so we leave the code here. It is potentially useful for other tools
454476// that want to invoke the rustc binary while linking to rustc as well.
0 commit comments