Skip to content

Commit 71a9b1b

Browse files
committed
windows-gnullvm: Avoid linking to libunwind statically
Avoid linking against the static variant of libunwind, which is not always available. Instead, prefer to use the unwind library from the toolchain, which the linker will automatically include, depending on what's available, and depending on the crt-static feature.
1 parent d3d145e commit 71a9b1b

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn opts() -> TargetOptions {
88
// but LLVM maintainers rejected it: https://reviews.llvm.org/D51440
99
let pre_link_args = TargetOptions::link_args(
1010
LinkerFlavor::Gnu(Cc::Yes, Lld::No),
11-
&["-nolibc", "--unwindlib=none"],
11+
&["-nolibc"],
1212
);
1313
// Order of `late_link_args*` does not matter with LLD.
1414
let late_link_args = TargetOptions::link_args(

library/unwind/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(link_cfg)]
44
#![feature(staged_api)]
55
#![feature(c_unwind)]
6-
#![cfg_attr(bootstrap, feature(cfg_target_abi))]
76
#![feature(strict_provenance)]
87
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
98
#![allow(internal_features)]

library/unwind/src/libunwind.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,7 @@ pub type _Unwind_Exception_Cleanup_Fn =
102102
// rustc_codegen_ssa::src::back::symbol_export, rustc_middle::middle::exported_symbols
103103
// and RFC 2841
104104
#[cfg_attr(
105-
any(
106-
all(
107-
feature = "llvm-libunwind",
108-
any(target_os = "fuchsia", target_os = "linux", target_os = "xous")
109-
),
110-
all(target_os = "windows", target_env = "gnu", target_abi = "llvm")
111-
),
105+
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux", target_os = "xous")),
112106
link(name = "unwind", kind = "static", modifiers = "-bundle")
113107
)]
114108
extern "C-unwind" {

0 commit comments

Comments
 (0)