Index: configure.ac --- configure.ac.orig +++ configure.ac @@ -1078,6 +1078,54 @@ if test "$nettle_cv_asm_x86_gnu_property" = yes; then .popsection' fi +dnl Define +dnl 1. ASM_X86_ENDBR for bti. +dnl 2. ASM_X86_MARK_CET to add a .note.gnu.property section to mark +dnl Arm BTI support if needed. +AC_CACHE_CHECK([if Arm BTI is enabled], + [nettle_cv_asm_arm_bti], + [AC_TRY_COMPILE([ +#ifndef __ARM_FEATURE_BTI_DEFAULT +#error Arm BTI is not enabled +#endif + ], [], + [nettle_cv_asm_arm_bti=yes], + [nettle_cv_asm_arm_bti=no])]) +if test "$nettle_cv_asm_arm_bti" = yes; then + ASM_X86_ENDBR="bti c" + AC_CACHE_CHECK([if .note.gnu.property section is needed], + [nettle_cv_asm_arm_gnu_property], + [AC_TRY_COMPILE([ +#if !defined __ELF__ || !defined __ARM_FEATURE_BTI_DEFAULT +#error GNU property is not needed +#endif + ], [], + [nettle_cv_asm_arm_gnu_property=yes], + [nettle_cv_asm_arm_gnu_property=no])]) +else + nettle_cv_asm_arm_gnu_property=no +fi +if test "$nettle_cv_asm_arm_gnu_property" = yes; then + ASM_X86_MARK_CET=' + .pushsection ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f + .long 4f - 1f + .long 5 +0: + .asciz "GNU" +1: + .p2align 3 + .long 0xc0000000 + .long 3f - 2f +2: + .long 1 +3: + .p2align 3 +4: + .popsection' +fi + AC_SUBST(ASM_SYMBOL_PREFIX) AC_SUBST(ASM_ELF_STYLE) AC_SUBST(ASM_COFF_STYLE)