Skip to content

Commit 7b513af

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 e631891 + 7333ee0 commit 7b513af

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

library/std/src/personality/gcc.rs

+1-1
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"]

library/unwind/src/lib.rs

-4
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" {}

library/unwind/src/libunwind.rs

+8-2
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" {

src/bootstrap/compile.rs

-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ fn copy_third_party_objects(
206206
}
207207

208208
if target == "x86_64-fortanix-unknown-sgx"
209-
|| target.contains("pc-windows-gnullvm")
210209
|| builder.config.llvm_libunwind(target) == LlvmLibunwind::InTree
211210
&& (target.contains("linux") || target.contains("fuchsia"))
212211
{

0 commit comments

Comments
 (0)