Skip to content

Commit

Permalink
control libunwind linkage mode via crt-static on gnullvm targets
Browse files Browse the repository at this point in the history
Co-authored-by: Kleis Auke Wolthuizen <[email protected]>
  • Loading branch information
mati865 and kleisauke committed Oct 3, 2024
1 parent 329e7b4 commit d442cf5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/spec/base/windows_gnullvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub(crate) fn opts() -> TargetOptions {
eh_frame_header: false,
no_default_libraries: false,
has_thread_local: true,
crt_static_allows_dylibs: true,
crt_static_respected: true,
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
// output DWO, despite using DWARF, doesn't use ELF..
debuginfo_kind: DebuginfoKind::Pdb,
Expand Down
5 changes: 5 additions & 0 deletions library/unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,8 @@ cfg_if::cfg_if! {
#[cfg(target_os = "hurd")]
#[link(name = "gcc_s")]
extern "C" {}

#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
extern "C" {}
9 changes: 3 additions & 6 deletions library/unwind/src/libunwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,9 @@ pub type _Unwind_Exception_Cleanup_Fn =
// rustc_codegen_ssa::src::back::symbol_export, rustc_middle::middle::exported_symbols
// and RFC 2841
#[cfg_attr(
any(
all(
feature = "llvm-libunwind",
any(target_os = "fuchsia", target_os = "linux", target_os = "xous")
),
all(target_os = "windows", target_env = "gnu", target_abi = "llvm")
all(
feature = "llvm-libunwind",
any(target_os = "fuchsia", target_os = "linux", target_os = "xous")
),
link(name = "unwind", kind = "static", modifiers = "-bundle")
)]
Expand Down

0 comments on commit d442cf5

Please sign in to comment.