diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-01 16:36:40 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-01 16:39:29 -0700 |
| commit | aa964bd555bf7d034b5bfea6275d6edddc35cb8c (patch) | |
| tree | 13f5a2b3eb2704f6dfc85f26bbd0bddb07049a42 /lib/libcxxabi/src/cxa_exception.cpp | |
| parent | bd680139d084b673d1f56d0e63e01936c4680a91 (diff) | |
| download | zig-aa964bd555bf7d034b5bfea6275d6edddc35cb8c.tar.gz zig-aa964bd555bf7d034b5bfea6275d6edddc35cb8c.zip | |
update libcxxabi to llvm 14.0.6
Diffstat (limited to 'lib/libcxxabi/src/cxa_exception.cpp')
| -rw-r--r-- | lib/libcxxabi/src/cxa_exception.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/libcxxabi/src/cxa_exception.cpp b/lib/libcxxabi/src/cxa_exception.cpp index 510827a37b..36388d50da 100644 --- a/lib/libcxxabi/src/cxa_exception.cpp +++ b/lib/libcxxabi/src/cxa_exception.cpp @@ -1,4 +1,4 @@ -//===------------------------- cxa_exception.cpp --------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -17,7 +17,7 @@ #include "cxa_exception.h" #include "cxa_handlers.h" #include "fallback_malloc.h" -#include "include/atomic_support.h" +#include "include/atomic_support.h" // from libc++ #if __has_feature(address_sanitizer) #include <sanitizer/asan_interface.h> @@ -341,8 +341,10 @@ unwinding with _Unwind_Resume. According to ARM EHABI 8.4.1, __cxa_end_cleanup() should not clobber any register, thus we have to write this function in assembly so that we can save {r1, r2, r3}. We don't have to save r0 because it is the return value and the -first argument to _Unwind_Resume(). In addition, we are saving r4 in order to -align the stack to 16 bytes, even though it is a callee-save register. +first argument to _Unwind_Resume(). In addition, we are saving lr in order to +align the stack to 16 bytes and lr will be used to identify the caller and its +frame information. _Unwind_Resume never return and we need to keep the original +lr so just branch to it. */ __attribute__((used)) static _Unwind_Exception * __cxa_end_cleanup_impl() @@ -372,18 +374,24 @@ __cxa_end_cleanup_impl() return &exception_header->unwindHeader; } -asm ( - " .pushsection .text.__cxa_end_cleanup,\"ax\",%progbits\n" +asm(" .pushsection .text.__cxa_end_cleanup,\"ax\",%progbits\n" " .globl __cxa_end_cleanup\n" " .type __cxa_end_cleanup,%function\n" "__cxa_end_cleanup:\n" - " push {r1, r2, r3, r4}\n" +#if defined(__ARM_FEATURE_BTI_DEFAULT) + " bti\n" +#endif + " push {r1, r2, r3, lr}\n" " bl __cxa_end_cleanup_impl\n" " pop {r1, r2, r3, r4}\n" - " bl _Unwind_Resume\n" - " bl abort\n" - " .popsection" -); + " mov lr, r4\n" +#if defined(LIBCXXABI_BAREMETAL) + " ldr r4, =_Unwind_Resume\n" + " bx r4\n" +#else + " b _Unwind_Resume\n" +#endif + " .popsection"); #endif // defined(_LIBCXXABI_ARM_EHABI) /* |
