[v2,2/6] aarch64: define BTI_C and BTI_J macros as NOP unless HAVE_AARCH64_BTI

Message ID 20210512092720.901129-1-naohirot@fujitsu.com
State New
Headers show
Series
  • aarch64: Added optimized memcpy/memmove/memset for A64FX
Related show

Commit Message

naohirot@fujitsu.com May 12, 2021, 9:27 a.m.
From: Naohiro Tamura <naohirot@jp.fujitsu.com>


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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.17.1

Comments

Adhemerval Zanella via Libc-alpha May 26, 2021, 10:06 a.m. | #1
The 05/12/2021 09:27, Naohiro Tamura wrote:
> From: Naohiro Tamura <naohirot@jp.fujitsu.com>

> 

> 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.


thanks. this is ok for master.

i will commit it.

> ---

>  sysdeps/aarch64/sysdep.h | 9 +++++++--

>  1 file changed, 7 insertions(+), 2 deletions(-)

> 

> diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h

> index 90acca4e42..b936e29cbd 100644

> --- a/sysdeps/aarch64/sysdep.h

> +++ b/sysdeps/aarch64/sysdep.h

> @@ -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

> -- 

> 2.17.1

>

Patch

diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h
index 90acca4e42..b936e29cbd 100644
--- a/sysdeps/aarch64/sysdep.h
+++ b/sysdeps/aarch64/sysdep.h
@@ -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