File tree 1 file changed +15
-3
lines changed
compiler/rustc_codegen_ssa/src/back
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -811,10 +811,22 @@ impl<'a> Linker for MsvcLinker<'a> {
811
811
self . cmd . arg ( format ! ( "{}{}" , name, if verbatim { "" } else { ".lib" } ) ) ;
812
812
}
813
813
814
- fn link_staticlib_by_name ( & mut self , name : & str , verbatim : bool , whole_archive : bool ) {
814
+ fn link_staticlib_by_name (
815
+ & mut self ,
816
+ name : & str ,
817
+ verbatim : bool ,
818
+ whole_archive : bool ,
819
+ search_paths : & SearchPaths ,
820
+ ) {
821
+ // Static libraries built by MSVC are usually called foo.lib.
822
+ // However, under MinGW and build systems such as Meson, they are
823
+ // called libfoo.a
815
824
let prefix = if whole_archive { "/WHOLEARCHIVE:" } else { "" } ;
816
- let suffix = if verbatim { "" } else { ".lib" } ;
817
- self . cmd . arg ( format ! ( "{prefix}{name}{suffix}" ) ) ;
825
+ let search_paths = search_paths. get ( self . sess ) ;
826
+ let path = find_native_static_library ( name, verbatim, search_paths, self . sess ) ;
827
+ let mut arg = OsString :: from ( prefix) ;
828
+ arg. push ( path) ;
829
+ self . cmd . arg ( arg) ;
818
830
}
819
831
820
832
fn link_staticlib_by_path ( & mut self , path : & Path , whole_archive : bool ) {
You can’t perform that action at this time.
0 commit comments