Skip to content

Commit 6723bf5

Browse files
committed
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
Change the way libunwind is linked for *-windows-gnullvm targets I have no idea why previous way works for `x86_64-fortanix-unknown-sgx` (assuming it actually works...) but not for `gnullvm`. It fails when linking libtest during Rust build (unless somebody adds `RUSTFLAGS='-Clinkarg=-lunwind'`). Also fixes exception handling on AArch64.
2 parents ea28fd5 + e066709 commit 6723bf5

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

std/src/personality/gcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ cfg_if::cfg_if! {
219219
}
220220

221221
cfg_if::cfg_if! {
222-
if #[cfg(all(windows, target_arch = "x86_64", target_env = "gnu"))] {
222+
if #[cfg(all(windows, any(target_arch = "aarch64", target_arch = "x86_64"), target_env = "gnu"))] {
223223
// On x86_64 MinGW targets, the unwinding mechanism is SEH however the unwind
224224
// handler data (aka LSDA) uses GCC-compatible encoding.
225225
#[lang = "eh_personality"]

unwind/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,3 @@ extern "C" {}
103103
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
104104
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
105105
extern "C" {}
106-
107-
#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
108-
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
109-
extern "C" {}

unwind/src/libunwind.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ pub const unwinder_private_data_size: usize = 20;
3636
#[cfg(all(target_arch = "arm", any(target_os = "ios", target_os = "watchos")))]
3737
pub const unwinder_private_data_size: usize = 5;
3838

39-
#[cfg(all(target_arch = "aarch64", target_pointer_width = "64"))]
39+
#[cfg(all(target_arch = "aarch64", target_pointer_width = "64", not(target_os = "windows")))]
4040
pub const unwinder_private_data_size: usize = 2;
4141

42+
#[cfg(all(target_arch = "aarch64", target_pointer_width = "64", target_os = "windows"))]
43+
pub const unwinder_private_data_size: usize = 6;
44+
4245
#[cfg(all(target_arch = "aarch64", target_pointer_width = "32"))]
4346
pub const unwinder_private_data_size: usize = 5;
4447

@@ -90,7 +93,10 @@ pub type _Unwind_Exception_Cleanup_Fn =
9093
// rustc_codegen_ssa::src::back::symbol_export, rustc_middle::middle::exported_symbols
9194
// and RFC 2841
9295
#[cfg_attr(
93-
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
96+
any(
97+
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
98+
all(target_os = "windows", target_env = "gnu", target_abi = "llvm")
99+
),
94100
link(name = "unwind", kind = "static", modifiers = "-bundle")
95101
)]
96102
extern "C-unwind" {

0 commit comments

Comments
 (0)