Skip to content

Commit e22a6ce

Browse files
committed
windows-gnullvm: include libunwind.dll in dist
1 parent 9cfe5f6 commit e22a6ce

File tree

1 file changed

+22
-7
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+22
-7
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,29 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
278278
return;
279279
}
280280

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+
}
286292
} else {
287-
rustc_dlls.push("libgcc_s_seh-1.dll");
293+
rustc_dlls.push("libunwind.dll");
288294
}
295+
// FIXME(#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+
};
289304
let rustc_dlls = find_files(&rustc_dlls, &bin_path);
290305

291306
// Copy runtime dlls next to rustc.exe
@@ -408,7 +423,7 @@ impl Step for Rustc {
408423
// anything requiring us to distribute a license, but it's likely the
409424
// install will *also* include the rust-mingw package, which also needs
410425
// 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 {
412427
runtime_dll_dist(tarball.image_dir(), host, builder);
413428
tarball.add_dir(builder.src.join("src/etc/third-party"), "share/doc");
414429
}

0 commit comments

Comments
 (0)