[libcxx-commits] [PATCH] D77786: [AArch64] Add v8.5 Branch Target Identification support.

Daniel Kiss via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 9 02:40:59 PDT 2020


danielkiss created this revision.
danielkiss added reviewers: phosek, tamas.petz, chill, olista01.
Herald added subscribers: libcxx-commits, llvm-commits, kristof.beyls.
Herald added projects: LLVM, libunwind.
Herald added a reviewer: libunwind.
danielkiss added a comment.

Please help me how to add a test for it, in the current state this patch won't do anything because the standard build for libunwind does not add -mbranch-protection=standard (or bti).


The .note.gnu.property must be in the assembly file to indicate the
support for BTI otherwise BTI will be disabled for the whole library.
__unw_getcontext and libunwind::Registers_arm64::jumpto() may be called
indirectly therefore they should start with a landing pad.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77786

Files:
  libunwind/src/assembly.h


Index: libunwind/src/assembly.h
===================================================================
--- libunwind/src/assembly.h
+++ libunwind/src/assembly.h
@@ -43,6 +43,23 @@
   .quad 0 SEPARATOR \
   .text SEPARATOR \
 .Lfunc_begin0:
+#elif (defined(__arm64__) || defined(__aarch64__)) && defined(__ARM_FEATURE_BTI_DEFAULT)
+#define PPC64_OPD1  \
+  .pushsection ".note.gnu.property", "a" SEPARATOR \
+  .balign 8 SEPARATOR \
+  .long 4 SEPARATOR \
+  .long 0x10 SEPARATOR \
+  .long 0x5 SEPARATOR \
+  .asciz "GNU" SEPARATOR \
+  /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ \
+  .long 0xc0000000 SEPARATOR \
+  .long 4 SEPARATOR \
+  /* GNU_PROPERTY_AARCH64_FEATURE_1_BTI */\
+  /* GNU_PROPERTY_AARCH64_FEATURE_1_PAC */\
+  .long 3 SEPARATOR \
+  .long 0 SEPARATOR \
+  .popsection SEPARATOR
+#define PPC64_OPD2  hint #34 /* bti c */
 #else
 #define PPC64_OPD1
 #define PPC64_OPD2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77786.256215.patch
Type: text/x-patch
Size: 882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200409/0cbf390a/attachment.bin>


More information about the libcxx-commits mailing list