@@ -359,21 +359,6 @@ fn link_rlib<'a>(
359
359
}
360
360
}
361
361
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
-
377
362
if let Some ( trailing_metadata) = trailing_metadata {
378
363
// Note that it is important that we add all of our non-object "magical
379
364
// files" *after* all of the object files in the archive. The reason for
@@ -414,12 +399,13 @@ fn link_rlib<'a>(
414
399
/// collate the symbols together by library name before generating the import libraries.
415
400
fn collate_raw_dylibs (
416
401
sess : & Session ,
417
- used_libraries : & [ NativeLib ] ,
402
+ crate_info : & CrateInfo ,
418
403
) -> Result < Vec < ( String , Vec < DllImport > ) > , ErrorGuaranteed > {
419
404
// Use index maps to preserve original order of imports and libraries.
420
405
let mut dylib_table = FxIndexMap :: < String , FxIndexMap < Symbol , & DllImport > > :: default ( ) ;
421
406
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 {
423
409
if lib. kind == NativeLibKind :: RawDylib {
424
410
let ext = if matches ! ( lib. verbatim, Some ( true ) ) { "" } else { ".dll" } ;
425
411
let name = format ! ( "{}{}" , lib. name. expect( "unnamed raw-dylib library" ) , ext) ;
@@ -2008,7 +1994,7 @@ fn linker_with_args<'a>(
2008
1994
2009
1995
// Link with the import library generated for any raw-dylib functions.
2010
1996
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 ) ?
2012
1998
{
2013
1999
cmd. add_object ( & archive_builder_builder. create_dll_import_lib (
2014
2000
sess,
0 commit comments