Skip to content

Commit 557c174

Browse files
toolchain: gcc: add fanalyzer config option
Add gcc config option for fanalyzer. As a result of this option, a static analysis of the program flow is conducted, allowing interprocedural paths to be identified and warnings to be issued if problems are identified. Link: openwrt/openwrt#12576 Signed-off-by: Nick Hainke <[email protected]>
1 parent 57e8eb6 commit 557c174

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

config/Config-build.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ menu "Global build settings"
250250

251251
comment "Hardening build options"
252252

253+
config PKG_FANALYZER
254+
bool
255+
prompt "Enable gcc fanalyzer"
256+
default n
257+
help
258+
Add -fanalyzer to the CFLAGS. As a result of this option, a static analysis
259+
of the program flow is conducted, allowing interprocedural paths to be
260+
identified and warnings to be issued if problems are identified.
261+
253262
config PKG_CHECK_FORMAT_SECURITY
254263
bool
255264
prompt "Enable gcc format-security"

include/hardening.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PKG_SSP ?= 1
99
PKG_FORTIFY_SOURCE ?= 1
1010
PKG_RELRO ?= 1
1111
PKG_DT_RELR ?= 1
12+
PKG_FANALYZER ?= 0
1213

1314
ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
1415
ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
@@ -77,3 +78,8 @@ ifdef CONFIG_PKG_DT_RELR
7778
endif
7879
endif
7980

81+
ifdef CONFIG_PKG_FANALYZER
82+
ifeq ($(strip $(PKG_FANALYZER)),1)
83+
TARGET_CFLAGS += -fanalyzer
84+
endif
85+
endif

0 commit comments

Comments
 (0)