From 8d4de28f89088f89f5392fd696e4daaad740638e Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Sun, 5 Jan 2025 18:02:29 +0000 Subject: [PATCH] Allow higher _FORTIFY_SOURCE levels --- config/base.mk | 3 +++ config/extra/with-security.mk | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/base.mk b/config/base.mk index c4eacd19da..bac55dc2e5 100644 --- a/config/base.mk +++ b/config/base.mk @@ -43,3 +43,6 @@ FUZZFLAGS:=-max_total_time=600 -timeout=10 -runs=10 # Obtain compiler version so that decisions can be made on disabling/enabling # certain flags CC_MAJOR_VERSION=$(shell $(CC) -dumpversion | cut -f1 -d.) + +# Default _FORTIFY_SOURCE level +FORTIFY_SOURCE?=2 diff --git a/config/extra/with-security.mk b/config/extra/with-security.mk index ad4aff4b0e..009536f89f 100644 --- a/config/extra/with-security.mk +++ b/config/extra/with-security.mk @@ -9,5 +9,5 @@ LDFLAGS+=-fstack-protector-strong # _FORTIFY_SOURCE only works when optimization is enabled ifeq ($(FD_DISABLE_OPTIMIZATION),) -CPPFLAGS+=-D_FORTIFY_SOURCE=2 +CPPFLAGS+=-D_FORTIFY_SOURCE=$(FORTIFY_SOURCE) endif