From 631cd5845e8de329d0e227aaa707d7ea228b8f8f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:29 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- library/unwind/src/lib.rs | 16 ++++++++++++++++ library/unwind/src/libunwind.rs | 3 +++ 2 files changed, 19 insertions(+) (limited to 'library/unwind') diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index edc10aa39..b655bae96 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -54,6 +54,22 @@ cfg_if::cfg_if! { } } +// This is the same as musl except that we default to using the system libunwind +// instead of libgcc. +#[cfg(target_env = "ohos")] +cfg_if::cfg_if! { + if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] { + compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time"); + } else if #[cfg(feature = "llvm-libunwind")] { + #[link(name = "unwind", kind = "static", modifiers = "-bundle")] + extern "C" {} + } else { + #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))] + #[link(name = "unwind", cfg(not(target_feature = "crt-static")))] + extern "C" {} + } +} + #[cfg(target_os = "android")] cfg_if::cfg_if! { if #[cfg(feature = "llvm-libunwind")] { diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs index eeeed3afc..f6a68073b 100644 --- a/library/unwind/src/libunwind.rs +++ b/library/unwind/src/libunwind.rs @@ -75,6 +75,9 @@ pub const unwinder_private_data_size: usize = 20; #[cfg(all(target_arch = "hexagon", target_os = "linux"))] pub const unwinder_private_data_size: usize = 35; +#[cfg(target_arch = "loongarch64")] +pub const unwinder_private_data_size: usize = 2; + #[repr(C)] pub struct _Unwind_Exception { pub exception_class: _Unwind_Exception_Class, -- cgit v1.2.3