File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 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> {
811811 self . cmd . arg ( format ! ( "{}{}" , name, if verbatim { "" } else { ".lib" } ) ) ;
812812 }
813813
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
815824 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) ;
818830 }
819831
820832 fn link_staticlib_by_path ( & mut self , path : & Path , whole_archive : bool ) {
You can’t perform that action at this time.
0 commit comments