diff options
| author | bors <bors@rust-lang.org> | 2022-11-13 21:12:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-13 21:12:48 +0000 |
| commit | 7b513af6c4b39b86f70b19fbd1a2dc72aa485d5c (patch) | |
| tree | 21f8885c16f5187a198f83283fc51263d07d0738 | |
| parent | e631891f7ad40eac3ef58ec3c2b57ecd81e40615 (diff) | |
| parent | 7333ee092b305a13cfdeabbd748ae1007985b4f1 (diff) | |
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.
| -rw-r--r-- | library/std/src/personality/gcc.rs | 2 | ||||
| -rw-r--r-- | library/unwind/src/lib.rs | 4 | ||||
| -rw-r--r-- | library/unwind/src/libunwind.rs | 10 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 1 |
4 files changed, 9 insertions, 8 deletions
diff --git a/library/std/src/personality/gcc.rs b/library/std/src/personality/gcc.rs index 7f0b0439cf0..5fc1b91a1c3 100644 --- a/library/std/src/personality/gcc.rs +++ b/library/std/src/personality/gcc.rs @@ -219,7 +219,7 @@ cfg_if::cfg_if! { } cfg_if::cfg_if! { - if #[cfg(all(windows, target_arch = "x86_64", target_env = "gnu"))] { + if #[cfg(all(windows, any(target_arch = "aarch64", target_arch = "x86_64"), target_env = "gnu"))] { // On x86_64 MinGW targets, the unwinding mechanism is SEH however the unwind // handler data (aka LSDA) uses GCC-compatible encoding. #[lang = "eh_personality"] diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 32c0ef3e116..2efd2d5dd4a 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -103,7 +103,3 @@ extern "C" {} #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] #[link(name = "unwind", kind = "static", modifiers = "-bundle")] extern "C" {} - -#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))] -#[link(name = "unwind", kind = "static", modifiers = "-bundle")] -extern "C" {} diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index a5b6193b086..15500f7fd35 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -36,9 +36,12 @@ pub const unwinder_private_data_size: usize = 20; #[cfg(all(target_arch = "arm", any(target_os = "ios", target_os = "watchos")))] pub const unwinder_private_data_size: usize = 5; -#[cfg(all(target_arch = "aarch64", target_pointer_width = "64"))] +#[cfg(all(target_arch = "aarch64", target_pointer_width = "64", not(target_os = "windows")))] pub const unwinder_private_data_size: usize = 2; +#[cfg(all(target_arch = "aarch64", target_pointer_width = "64", target_os = "windows"))] +pub const unwinder_private_data_size: usize = 6; + #[cfg(all(target_arch = "aarch64", target_pointer_width = "32"))] pub const unwinder_private_data_size: usize = 5; @@ -90,7 +93,10 @@ pub type _Unwind_Exception_Cleanup_Fn = // rustc_codegen_ssa::src::back::symbol_export, rustc_middle::middle::exported_symbols // and RFC 2841 #[cfg_attr( - all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")), + any( + all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")), + all(target_os = "windows", target_env = "gnu", target_abi = "llvm") + ), link(name = "unwind", kind = "static", modifiers = "-bundle") )] extern "C-unwind" { diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 79e07be614c..67947a263dc 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -206,7 +206,6 @@ fn copy_third_party_objects( } if target == "x86_64-fortanix-unknown-sgx" - || target.contains("pc-windows-gnullvm") || builder.config.llvm_libunwind(target) == LlvmLibunwind::InTree && (target.contains("linux") || target.contains("fuchsia")) { |
