Skip to content

Commit 766fba3

Browse files
committed
Auto merge of #67779 - Amanieu:ehabi_fix, r=Mark-Simulacrum
Update the barrier cache during ARM EHABI unwinding Fixes #67242 r? @alexcrichton
2 parents 68fdecd + 057ad39 commit 766fba3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/libpanic_unwind/gcc.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,13 @@ cfg_if::cfg_if! {
188188
match eh_action {
189189
EHAction::None |
190190
EHAction::Cleanup(_) => return continue_unwind(exception_object, context),
191-
EHAction::Catch(_) => return uw::_URC_HANDLER_FOUND,
191+
EHAction::Catch(_) => {
192+
// EHABI requires the personality routine to update the
193+
// SP value in the barrier cache of the exception object.
194+
(*exception_object).private[5] =
195+
uw::_Unwind_GetGR(context, uw::UNWIND_SP_REG);
196+
return uw::_URC_HANDLER_FOUND;
197+
}
192198
EHAction::Terminate => return uw::_URC_FAILURE,
193199
}
194200
} else {

src/libunwind/libunwind.rs

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub type _Unwind_Word = uintptr_t;
2323
pub type _Unwind_Ptr = uintptr_t;
2424
pub type _Unwind_Trace_Fn =
2525
extern "C" fn(ctx: *mut _Unwind_Context, arg: *mut c_void) -> _Unwind_Reason_Code;
26+
2627
#[cfg(target_arch = "x86")]
2728
pub const unwinder_private_data_size: usize = 5;
2829

@@ -152,6 +153,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
152153
use _Unwind_VRS_DataRepresentation::*;
153154

154155
pub const UNWIND_POINTER_REG: c_int = 12;
156+
pub const UNWIND_SP_REG: c_int = 13;
155157
pub const UNWIND_IP_REG: c_int = 15;
156158

157159
#[cfg_attr(all(feature = "llvm-libunwind",

0 commit comments

Comments
 (0)