git: 43e8849bc294 - main - conf: Enable BTI checking in the arm64 kernel
Date: Tue, 20 Aug 2024 09:02:11 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=43e8849bc29414036ccaef7788de95a07ad32ab5
commit 43e8849bc29414036ccaef7788de95a07ad32ab5
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-08-19 12:59:49 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-08-20 08:49:15 +0000
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 93187d93ac63..079bd1173fad 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