From 1b8db4b4e3614ef6334ce776dcdd46fe7f2c5a78 Mon Sep 17 00:00:00 2001 From: Mitchell Horne Date: Wed, 4 Aug 2021 15:18:18 -0300 Subject: [PATCH] arm: enable stack-smashing protection With current generation clang/llvm it can pass all of our tests in libc/ssp. While here, remove the extra MACHINE_CPUARCH check for mips. SSP is included in BROKEN_OPTIONS for this architecture in src.opts.mk, which is enough to ensure normal builds won't set SSP_CFLAGS. Reviewed by: kevans, imp, emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31400 --- share/mk/bsd.sys.mk | 5 ++--- sys/conf/kern.mk | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 6341800d5c7..031d49bbaca 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -239,12 +239,11 @@ CFLAGS.clang+= -Qunused-arguments # but not yet. CXXFLAGS.clang+= -Wno-c++11-extensions -.if ${MK_SSP} != "no" && \ - ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" +.if ${MK_SSP} != "no" # Don't use -Wstack-protector as it breaks world with -Werror. SSP_CFLAGS?= -fstack-protector-strong CFLAGS+= ${SSP_CFLAGS} -.endif # SSP && !ARM && !MIPS +.endif # SSP # Additional flags passed in CFLAGS and CXXFLAGS when MK_DEBUG_FILES is # enabled. diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index f8ea372b1d9..56bddb35398 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -213,8 +213,7 @@ CFLAGS+= -fwrapv # # GCC SSP support # -.if ${MK_SSP} != "no" && \ - ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" +.if ${MK_SSP} != "no" CFLAGS+= -fstack-protector .endif -- 2.45.2