@@ -359,21 +359,6 @@ fn link_rlib<'a>(
359359 }
360360 }
361361
362- for ( raw_dylib_name, raw_dylib_imports) in
363- collate_raw_dylibs ( sess, & codegen_results. crate_info . used_libraries ) ?
364- {
365- let output_path = archive_builder_builder. create_dll_import_lib (
366- sess,
367- & raw_dylib_name,
368- & raw_dylib_imports,
369- tmpdir. as_ref ( ) ,
370- ) ;
371-
372- ab. add_archive ( & output_path, Box :: new ( |_| false ) ) . unwrap_or_else ( |e| {
373- sess. fatal ( & format ! ( "failed to add native library {}: {}" , output_path. display( ) , e) ) ;
374- } ) ;
375- }
376-
377362 if let Some ( trailing_metadata) = trailing_metadata {
378363 // Note that it is important that we add all of our non-object "magical
379364 // files" *after* all of the object files in the archive. The reason for
@@ -414,12 +399,13 @@ fn link_rlib<'a>(
414399/// collate the symbols together by library name before generating the import libraries.
415400fn collate_raw_dylibs (
416401 sess : & Session ,
417- used_libraries : & [ NativeLib ] ,
402+ crate_info : & CrateInfo ,
418403) -> Result < Vec < ( String , Vec < DllImport > ) > , ErrorGuaranteed > {
419404 // Use index maps to preserve original order of imports and libraries.
420405 let mut dylib_table = FxIndexMap :: < String , FxIndexMap < Symbol , & DllImport > > :: default ( ) ;
421406
422- for lib in used_libraries {
407+ let all_libs = crate_info. used_libraries . iter ( ) . chain ( crate_info. native_libraries . values ( ) . flatten ( ) ) ;
408+ for lib in all_libs {
423409 if lib. kind == NativeLibKind :: RawDylib {
424410 let ext = if matches ! ( lib. verbatim, Some ( true ) ) { "" } else { ".dll" } ;
425411 let name = format ! ( "{}{}" , lib. name. expect( "unnamed raw-dylib library" ) , ext) ;
@@ -2008,7 +1994,7 @@ fn linker_with_args<'a>(
20081994
20091995 // Link with the import library generated for any raw-dylib functions.
20101996 for ( raw_dylib_name, raw_dylib_imports) in
2011- collate_raw_dylibs ( sess, & codegen_results. crate_info . used_libraries ) ?
1997+ collate_raw_dylibs ( sess, & codegen_results. crate_info ) ?
20121998 {
20131999 cmd. add_object ( & archive_builder_builder. create_dll_import_lib (
20142000 sess,
0 commit comments