diff --git a/sys/arm64/arm64/bus_space_asm.S b/sys/arm64/arm64/bus_space_asm.S --- a/sys/arm64/arm64/bus_space_asm.S +++ b/sys/arm64/arm64/bus_space_asm.S @@ -25,7 +25,9 @@ * */ +#include #include + ENTRY(generic_bs_r_1) ldrb w0, [x1, x2] ret @@ -475,3 +477,5 @@ mov x0, #0 ret END(generic_bs_poke_8) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/copyinout.S b/sys/arm64/arm64/copyinout.S --- a/sys/arm64/arm64/copyinout.S +++ b/sys/arm64/arm64/copyinout.S @@ -27,9 +27,10 @@ * */ -#include +#include #include +#include #include #include @@ -220,3 +221,5 @@ mov x0, xzr /* return 0 */ ret .size copycommon, . - copycommon + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/cpufunc_asm.S b/sys/arm64/arm64/cpufunc_asm.S --- a/sys/arm64/arm64/cpufunc_asm.S +++ b/sys/arm64/arm64/cpufunc_asm.S @@ -29,7 +29,9 @@ * */ +#include #include + #include #include @@ -190,3 +192,5 @@ mov x0, #EFAULT ret END(cache_maint_fault) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -25,6 +25,8 @@ * */ +#include + #include #include #include "assym.inc" @@ -324,3 +326,4 @@ vempty 0 /* FIQ 32-bit EL0 */ vector el0_serror 0 /* Error 32-bit EL0 */ +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/hyp_stub.S b/sys/arm64/arm64/hyp_stub.S --- a/sys/arm64/arm64/hyp_stub.S +++ b/sys/arm64/arm64/hyp_stub.S @@ -24,6 +24,8 @@ * SUCH DAMAGE. */ +#include + #include .macro vempty @@ -63,3 +65,5 @@ vempty /* IRQ 32-bit EL1 */ vempty /* FIQ 32-bit EL1 */ vempty /* SError 32-bit EL1 */ + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -26,6 +26,7 @@ #include "assym.inc" #include "opt_kstack_pages.h" +#include #include #include #include @@ -1006,3 +1007,5 @@ .global sz_aarch32_sigcode sz_aarch32_sigcode: .quad aarch32_esigcode - aarch32_sigcode + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/memcmp.S b/sys/arm64/arm64/memcmp.S --- a/sys/arm64/arm64/memcmp.S +++ b/sys/arm64/arm64/memcmp.S @@ -9,6 +9,8 @@ * ARMv8-a, AArch64, unaligned accesses. */ +#include + #include #define L(l) .L ## l @@ -134,3 +136,4 @@ END (memcmp) +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/memcpy.S b/sys/arm64/arm64/memcpy.S --- a/sys/arm64/arm64/memcpy.S +++ b/sys/arm64/arm64/memcpy.S @@ -11,6 +11,8 @@ * */ +#include + #include #define L(l) .L ## l @@ -240,3 +242,4 @@ END(memcpy) EEND(memmove) +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/memset.S b/sys/arm64/arm64/memset.S --- a/sys/arm64/arm64/memset.S +++ b/sys/arm64/arm64/memset.S @@ -31,6 +31,8 @@ * */ +#include + #include #define dstin x0 @@ -195,3 +197,5 @@ b.ne .Ltail_maybe_long ret END(memset) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/sigtramp.S b/sys/arm64/arm64/sigtramp.S --- a/sys/arm64/arm64/sigtramp.S +++ b/sys/arm64/arm64/sigtramp.S @@ -27,6 +27,7 @@ */ #include "assym.inc" +#include #include #include @@ -57,3 +58,5 @@ .global szsigcode szsigcode: .quad esigcode - sigcode + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/strcmp.S b/sys/arm64/arm64/strcmp.S --- a/sys/arm64/arm64/strcmp.S +++ b/sys/arm64/arm64/strcmp.S @@ -12,6 +12,8 @@ * MTE compatible. */ +#include + #include #define L(l) .L ## l @@ -187,3 +189,4 @@ END (strcmp) +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/strncmp.S b/sys/arm64/arm64/strncmp.S --- a/sys/arm64/arm64/strncmp.S +++ b/sys/arm64/arm64/strncmp.S @@ -11,6 +11,8 @@ * MTE compatible. */ +#include + #include #define L(l) .L ## l @@ -305,3 +307,4 @@ ret END(strncmp) +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/support.S b/sys/arm64/arm64/support.S --- a/sys/arm64/arm64/support.S +++ b/sys/arm64/arm64/support.S @@ -29,6 +29,8 @@ * */ +#include + #include #include #include @@ -387,3 +389,5 @@ ret END(pagezero_cache) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -33,6 +33,8 @@ #include "opt_kstack_pages.h" #include "opt_sched.h" +#include + #include #include .macro clear_step_flag pcbflags, tmp @@ -277,3 +279,4 @@ ret END(savectx) +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/vmm/vmm_call.S b/sys/arm64/vmm/vmm_call.S --- a/sys/arm64/vmm/vmm_call.S +++ b/sys/arm64/vmm/vmm_call.S @@ -28,6 +28,7 @@ * SUCH DAMAGE. */ +#include #include @@ -37,3 +38,5 @@ hvc #0 ret END(vmm_call_hyp) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/arm64/vmm/vmm_hyp_el2.S b/sys/arm64/vmm/vmm_hyp_el2.S --- a/sys/arm64/vmm/vmm_hyp_el2.S +++ b/sys/arm64/vmm/vmm_hyp_el2.S @@ -28,6 +28,9 @@ * SUCH DAMAGE. */ +#include + +#include #include .section .rodata @@ -37,3 +40,5 @@ .incbin "vmm_hyp_blob.bin" .globl vmm_hyp_code_end vmm_hyp_code_end: + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S b/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S --- a/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S +++ b/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -172,3 +173,5 @@ 2: mov x0, x3 /* Return the value loaded from target */ RET END(dtrace_casptr) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -65,7 +65,7 @@ arm64/arm64/ofw_machdep.c optional fdt arm64/arm64/pl031_rtc.c optional fdt pl031 arm64/arm64/ptrauth.c standard \ - compile-with "${NORMAL_C:N-mbranch-protection*}" + compile-with "${NORMAL_C:N-mbranch-protection*} -mbranch-protection=bti" arm64/arm64/pmap.c standard arm64/arm64/ptrace_machdep.c standard arm64/arm64/sigtramp.S standard diff --git a/sys/dev/psci/smccc_arm64.S b/sys/dev/psci/smccc_arm64.S --- a/sys/dev/psci/smccc_arm64.S +++ b/sys/dev/psci/smccc_arm64.S @@ -30,7 +30,10 @@ * SUCH DAMAGE. */ +#include + #include + .macro arm_smccc_1_0 insn ENTRY(arm_smccc_\insn) \insn #0 @@ -84,3 +87,5 @@ */ arm_smccc_1_2 hvc arm_smccc_1_2 smc + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/sys/kern/firmw.S b/sys/kern/firmw.S --- a/sys/kern/firmw.S +++ b/sys/kern/firmw.S @@ -45,3 +45,9 @@ .type FIRMW_END(FIRMW_SYMBOL), %object FIRMW_END(FIRMW_SYMBOL): .size FIRMW_END(FIRMW_SYMBOL), . - FIRMW_END(FIRMW_SYMBOL) + +#if defined(__aarch64__) +#include +#include +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) +#endif diff --git a/sys/modules/vmm/Makefile b/sys/modules/vmm/Makefile --- a/sys/modules/vmm/Makefile +++ b/sys/modules/vmm/Makefile @@ -50,7 +50,7 @@ vmm_hyp_blob.elf.full: vmm_hyp_exception.o vmm_hyp.o ${LD} -m ${LD_EMULATION} -Bdynamic -T ${SYSDIR}/conf/ldscript.arm64 \ - ${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \ + ${_LDFLAGS:N-zbti-report*} --no-warn-mismatch --warn-common --export-dynamic \ --dynamic-linker /red/herring -X -o ${.TARGET} ${.ALLSRC} \ --defsym=_start='0x0' --defsym=text_start='0x0'