Skip to content

Commit d2e3ea9

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

File tree

1 file changed

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

1 file changed

+24
-7
lines changed

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

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,31 @@ 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+
}
292+
} else if target.ends_with("windows-gnullvm") {
293+
rustc_dlls.push("libunwind.dll");
286294
} else {
287-
rustc_dlls.push("libgcc_s_seh-1.dll");
295+
panic!("Vendoring of runtime DLLs for `{target}` is not supported`");
288296
}
297+
// FIXME(#144656): Remove this whole `let ...`
298+
let bin_path = if target.ends_with("windows-gnullvm") && builder.host_target != target {
299+
bin_path
300+
.into_iter()
301+
.chain(libs_path.iter().map(|path| path.with_file_name("bin")))
302+
.collect()
303+
} else {
304+
bin_path
305+
};
289306
let rustc_dlls = find_files(&rustc_dlls, &bin_path);
290307

291308
// Copy runtime dlls next to rustc.exe
@@ -408,7 +425,7 @@ impl Step for Rustc {
408425
// anything requiring us to distribute a license, but it's likely the
409426
// install will *also* include the rust-mingw package, which also needs
410427
// 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 {
428+
if host.contains("pc-windows-gnu") && builder.config.dist_include_mingw_linker {
412429
runtime_dll_dist(tarball.image_dir(), host, builder);
413430
tarball.add_dir(builder.src.join("src/etc/third-party"), "share/doc");
414431
}

0 commit comments

Comments
 (0)