Date: Mon, 15 Aug 2022 01:05:30 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 787be9e9c32a - stable/13 - Merge libcxxrt commit 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd Message-ID: <202208150105.27F15Uid021084@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=787be9e9c32a3cf6e9999f175555bbdcb31f61f2 commit 787be9e9c32a3cf6e9999f175555bbdcb31f61f2 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-08-08 16:30:56 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-08-15 01:04:23 +0000 Merge libcxxrt commit 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd Fix two bugs in __cxa_end_cleanup() Per the EHABI32 specification, __cxa_end_cleanup must take care to preserve registers before calling _Unwind_Resume(). So, libcxxrt uses an assembly stub which preserves caller-saved registers around the call to __cxa_get_cleanup(). But: - it failed to restore them properly, - it did not preserve the link register. Fix both of these problems. This is needed to fix exception unwinding on FreeBSD with LLVM 14. Note that r4 is callee-saved but is pushed onto the stack to preserve stack pointer alignment. Sponsored-by: The FreeBSD Foundation (cherry picked from commit cbd1e83154af8bae3daa3919bb2746d587436515) --- contrib/libcxxrt/exception.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index f28082ab7e80..6c5196876b10 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -1577,8 +1577,10 @@ asm ( ".type __cxa_end_cleanup, \"function\" \n" "__cxa_end_cleanup: \n" " push {r1, r2, r3, r4} \n" +" mov r4, lr \n" " bl __cxa_get_cleanup \n" -" push {r1, r2, r3, r4} \n" +" mov lr, r4 \n" +" pop {r1, r2, r3, r4} \n" " b _Unwind_Resume \n" " bl abort \n" ".popsection \n"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202208150105.27F15Uid021084>