@@ -278,14 +278,29 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
278
278
return ;
279
279
}
280
280
281
- let ( bin_path, _) = get_cc_search_dirs ( target, builder) ;
282
-
283
- let mut rustc_dlls = vec ! [ "libwinpthread-1.dll" ] ;
284
- if target. starts_with ( "i686-" ) {
285
- rustc_dlls. push ( "libgcc_s_dw2-1.dll" ) ;
281
+ let ( bin_path, libs_path) = get_cc_search_dirs ( target, builder) ;
282
+
283
+ let mut rustc_dlls = vec ! [ ] ;
284
+ // windows-gnu and windows-gnullvm require different runtime libs
285
+ if target. ends_with ( "windows-gnu" ) {
286
+ rustc_dlls. push ( "libwinpthread-1.dll" ) ;
287
+ if target. starts_with ( "i686-" ) {
288
+ rustc_dlls. push ( "libgcc_s_dw2-1.dll" ) ;
289
+ } else {
290
+ rustc_dlls. push ( "libgcc_s_seh-1.dll" ) ;
291
+ }
286
292
} else {
287
- rustc_dlls. push ( "libgcc_s_seh-1 .dll" ) ;
293
+ rustc_dlls. push ( "libunwind .dll" ) ;
288
294
}
295
+ // TODO(#144565): Remove this whole `let ...`
296
+ let bin_path = if target. ends_with ( "windows-gnullvm" ) && builder. host_target != target {
297
+ bin_path
298
+ . into_iter ( )
299
+ . chain ( libs_path. iter ( ) . map ( |path| path. with_file_name ( "bin" ) ) )
300
+ . collect ( )
301
+ } else {
302
+ bin_path
303
+ } ;
289
304
let rustc_dlls = find_files ( & rustc_dlls, & bin_path) ;
290
305
291
306
// Copy runtime dlls next to rustc.exe
@@ -408,7 +423,7 @@ impl Step for Rustc {
408
423
// anything requiring us to distribute a license, but it's likely the
409
424
// install will *also* include the rust-mingw package, which also needs
410
425
// licenses, so to be safe we just include it here in all MinGW packages.
411
- if host. ends_with ( "pc-windows-gnu" ) && builder. config . dist_include_mingw_linker {
426
+ if host. contains ( "pc-windows-gnu" ) && builder. config . dist_include_mingw_linker {
412
427
runtime_dll_dist ( tarball. image_dir ( ) , host, builder) ;
413
428
tarball. add_dir ( builder. src . join ( "src/etc/third-party" ) , "share/doc" ) ;
414
429
}
0 commit comments