Skip to content

Commit d442cf5

Browse files
mati865kleisauke
andcommitted
control libunwind linkage mode via crt-static on gnullvm targets
Co-authored-by: Kleis Auke Wolthuizen <[email protected]>
1 parent 329e7b4 commit d442cf5

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ pub(crate) fn opts() -> TargetOptions {
4242
eh_frame_header: false,
4343
no_default_libraries: false,
4444
has_thread_local: true,
45+
crt_static_allows_dylibs: true,
46+
crt_static_respected: true,
4547
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
4648
// output DWO, despite using DWARF, doesn't use ELF..
4749
debuginfo_kind: DebuginfoKind::Pdb,

library/unwind/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,8 @@ cfg_if::cfg_if! {
180180
#[cfg(target_os = "hurd")]
181181
#[link(name = "gcc_s")]
182182
extern "C" {}
183+
184+
#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
185+
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
186+
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
187+
extern "C" {}

library/unwind/src/libunwind.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,9 @@ 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")
105+
all(
106+
feature = "llvm-libunwind",
107+
any(target_os = "fuchsia", target_os = "linux", target_os = "xous")
111108
),
112109
link(name = "unwind", kind = "static", modifiers = "-bundle")
113110
)]

0 commit comments

Comments
 (0)