[ARM][libcxxabi] Add PACBTI-M support to libcxxabi
This change consists of just adding 'BTI' to the prologue of Arm assembly
functions, which is just the one: __cxa_end_cleanup
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Mikhail Maltsev
Reviewed By: lenary, danielkiss
Differential Revision: https://reviews.llvm.org/D112432
GitOrigin-RevId: 69faae2376c1a5beccdfbf103346354c68f3570c
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 5e77104..36388d5 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -378,6 +378,9 @@
" .globl __cxa_end_cleanup\n"
" .type __cxa_end_cleanup,%function\n"
"__cxa_end_cleanup:\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"