[libunwind] [libunwind] [SEH] Set NonVolatileRegisters before calling a personality function (PR #137951)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 30 03:50:23 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libunwind
Author: Martin Storsjö (mstorsjo)
<details>
<summary>Changes</summary>
The CRT __C_specific_handler function uses this for restoring registers before calling the filter function.
This fixes the libunwind/libcxxabi forced unwind testcases on ARM and AArch64.
---
Full diff: https://github.com/llvm/llvm-project/pull/137951.diff
1 Files Affected:
- (modified) libunwind/src/Unwind-seh.cpp (+5)
``````````diff
diff --git a/libunwind/src/Unwind-seh.cpp b/libunwind/src/Unwind-seh.cpp
index b2bb119ed6d29..f6525af07e25f 100644
--- a/libunwind/src/Unwind-seh.cpp
+++ b/libunwind/src/Unwind-seh.cpp
@@ -212,6 +212,11 @@ __libunwind_seh_personality(int version, _Unwind_Action state,
ms_exc.ExceptionInformation[2] = state;
DISPATCHER_CONTEXT *disp_ctx =
__unw_seh_get_disp_ctx((unw_cursor_t *)context);
+#if defined(__aarch64__)
+ disp_ctx->NonVolatileRegisters = (PBYTE)&disp_ctx->ContextRecord->X19;
+#elif defined(__arm__)
+ disp_ctx->NonVolatileRegisters = (PBYTE)&disp_ctx->ContextRecord->R4;
+#endif
_LIBUNWIND_TRACE_UNWINDING("__libunwind_seh_personality() calling "
"LanguageHandler %p(%p, %p, %p, %p)",
(void *)disp_ctx->LanguageHandler, (void *)&ms_exc,
``````````
</details>
https://github.com/llvm/llvm-project/pull/137951
More information about the cfe-commits
mailing list