Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35bb5b1e authored by Andi Kleen's avatar Andi Kleen Committed by Sam Ravnborg
Browse files

Add option to enable -Wframe-larger-than= on gcc 4.4



Add option to enable -Wframe-larger-than= on gcc 4.4

gcc mainline (upcoming 4.4) added a new -Wframe-larger-than=...
option to warn at build time about too large stack frames. Add a config
option to enable this warning, since this very useful for the kernel.

I choose (somewhat arbitarily) 2048 as default warning threshold for 64bit
and 1024 as default for 32bit architectures.  With some research and
fixing all the code for smaller values these defaults should be probably
lowered.

With the default allyesconfigs have some new warnings, but I think
that is all code that should be just fixed.

At some point (when gcc 4.4 is released and widely used) this should
obsolete make checkstack

Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 80ff2624
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -507,6 +507,10 @@ else
KBUILD_CFLAGS	+= -O2
KBUILD_CFLAGS	+= -O2
endif
endif


ifneq (CONFIG_FRAME_WARN,0)
KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
endif

# Force gcc to behave correct even for buggy distributions
# Force gcc to behave correct even for buggy distributions
# Arch Makefiles may override this setting
# Arch Makefiles may override this setting
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
+11 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,17 @@ config ENABLE_MUST_CHECK
	  suppress the "warning: ignoring return value of 'foo', declared with
	  suppress the "warning: ignoring return value of 'foo', declared with
	  attribute warn_unused_result" messages.
	  attribute warn_unused_result" messages.


config FRAME_WARN
	int "Warn for stack frames larger than (needs gcc 4.4)"
	range 0 8192
	default 1024 if !64BIT
	default 2048 if 64BIT
	help
	  Tell gcc to warn at build time for stack frames larger than this.
	  Setting this too low will cause a lot of warnings.
	  Setting it to 0 disables the warning.
	  Requires gcc 4.4

config MAGIC_SYSRQ
config MAGIC_SYSRQ
	bool "Magic SysRq key"
	bool "Magic SysRq key"
	depends on !UML
	depends on !UML