Skip to content

Commit 5fc8828

Browse files
committed
Auto merge of #160712 - mati865:gnullvm-static-libunwind, r=<try>
windows-gnullvm: always link libunwind statically try-job: *gnullvm
2 parents 65bcac4 + 501c282 commit 5fc8828

4 files changed

Lines changed: 3 additions & 10 deletions

File tree

compiler/rustc_target/src/spec/base/windows_gnullvm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ pub(crate) fn opts() -> TargetOptions {
1313
// but LLVM maintainers rejected it: https://reviews.llvm.org/D51440
1414
let pre_link_args = TargetOptions::link_args(
1515
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
16-
&["-nolibc", "--unwindlib=none"],
16+
&["-nolibc", "--unwindlib=libunwind", "-static-libgcc"],
1717
);
1818
// Order of `late_link_args*` does not matter with LLD.
1919
let mingw_libs = &["-lmingw32", "-lmingwex", "-lmsvcrt", "-lkernel32", "-luser32"];
2020

2121
let mut late_link_args =
2222
TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), mingw_libs);
23+
add_link_args(&mut late_link_args, LinkerFlavor::Gnu(Cc::No, Lld::No), &["-l:libunwind.a"]);
2324
add_link_args(&mut late_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), mingw_libs);
2425

2526
TargetOptions {
@@ -46,8 +47,6 @@ pub(crate) fn opts() -> TargetOptions {
4647
eh_frame_header: false,
4748
no_default_libraries: false,
4849
has_thread_local: true,
49-
crt_static_allows_dylibs: true,
50-
crt_static_respected: true,
5150
debuginfo_kind: DebuginfoKind::Dwarf,
5251
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
5352
// output DWO, despite using DWARF, doesn't use ELF..

library/unwind/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,3 @@ cfg_select! {
214214
#[cfg(target_os = "hurd")]
215215
#[link(name = "gcc_s")]
216216
unsafe extern "C" {}
217-
218-
#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
219-
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
220-
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
221-
unsafe extern "C" {}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ fn make_win_llvm_dist(plat_root: &Path, target: TargetSelection, builder: &Build
323323
let target_libs = [
324324
// MinGW libs
325325
"libunwind.a",
326-
"libunwind.dll.a",
327326
"libmingw32.a",
328327
"libmingwex.a",
329328
"libmsvcrt.a",

src/doc/rustc/src/platform-support/windows-gnullvm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Target triples available so far:
1919
## Requirements
2020

2121
Building those targets requires an LLVM-based C toolchain, for example, [llvm-mingw][1] or [MSYS2][2] with CLANG*
22-
environment.
22+
environment, with static libunwind library available.
2323

2424
Binaries for this target should be at least on par with `*-windows-gnu` in terms of requirements and functionality,
2525
except for implicit self-contained mode (explained in [the section below](#building-rust-programs)).

0 commit comments

Comments
 (0)