aarch64: define BTI_C and BTI_J macros as NOP unless HAVE_AARCH64_BTI
authorNaohiro Tamura <naohirot@jp.fujitsu.com>
Wed, 12 May 2021 09:27:20 +0000 (09:27 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 26 May 2021 11:01:06 +0000 (12:01 +0100)
This patch defines BTI_C and BTI_J macros conditionally for
performance.
If HAVE_AARCH64_BTI is true, BTI_C and BTI_J are defined as HINT
instruction for ARMv8.5 BTI (Branch Target Identification).
If HAVE_AARCH64_BTI is false, both BTI_C and BTI_J are defined as
NOP.

sysdeps/aarch64/sysdep.h

index 90acca4..b936e29 100644 (file)
@@ -62,8 +62,13 @@ strip_pac (void *p)
 #define ASM_SIZE_DIRECTIVE(name) .size name,.-name
 
 /* Branch Target Identitication support.  */
-#define BTI_C          hint    34
-#define BTI_J          hint    36
+#if HAVE_AARCH64_BTI
+# define BTI_C         hint    34
+# define BTI_J         hint    36
+#else
+# define BTI_C         nop
+# define BTI_J         nop
+#endif
 
 /* Return address signing support (pac-ret).  */
 #define PACIASP                hint    25