From 43e8849bc29414036ccaef7788de95a07ad32ab5 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Mon, 19 Aug 2024 13:59:49 +0100 Subject: [PATCH] conf: Enable BTI checking in the arm64 kernel To ensure new code has BTI support make it an error to not have the BTI ELF note when linking the kernel and kernel modules. Reviewed by: kib, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45469 --- sys/conf/kern.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 93187d93ac6..079bd1173fa 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -143,6 +143,9 @@ CFLAGS += -mgeneral-regs-only CFLAGS += -ffixed-x18 # Build with BTI+PAC CFLAGS += -mbranch-protection=standard +.if ${LINKER_TYPE} == "lld" +LDFLAGS += -Wl,-zbti-report=error +.endif # TODO: support outline atomics CFLAGS += -mno-outline-atomics INLINE_LIMIT?= 8000