coreboot/src
Julius Werner 6754c00028 arm, arm64, mips: Add rough static stack size checks with -Wstack-usage
We've seen an increasing need to reduce stack sizes more and more for
space reasons, and it's always guesswork because no one has a good idea
how little is too litte. We now have boards with 3K and 2K stacks, and
old pieces of common code often allocate large temporary buffers that
would lead to very dangerous and hard to detect bugs when someone
eventually tries to use them on one of those.

This patch tries improve this situation at least a bit by declaring 2K
as the minimum stack size all of coreboot code should work with. It
checks all function frames with -Wstack-usage=1536 to make sure we don't
allocate more than 1.5K in a single buffer. This is of course not a
perfect test, but it should catch the most common situation of declaring
a single, large buffer in some close-to-leaf function (with the
assumption that 512K is hopefully enough for all the "normal" functions
above that).

Change one example where we were a bit overzealous and put a 1K buffer
into BSS back to stack allocation, since it actually conforms to this
new assumption and frees up another kilobyte of that highly sought-after
verstage space. Not touching x86 with any of this since it's lack of
__PRE_RAM__ BSS often requires it to allocate way more on the stack than
would usually be considered sane.

BRANCH=veyron
BUG=None
TEST=Compiled Cosmos, Daisy, Falco, Blaze, Pit, Storm, Urara and Pinky,
made sure they still build as well as before and don't show any stack
usage warnings.

Change-Id: I30bd9c2c77e0e0623df89b9e5bb43ed29506be98
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236978
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/242137
2015-01-21 01:16:47 +00:00
..
arch arm, arm64, mips: Add rough static stack size checks with -Wstack-usage 2015-01-21 01:16:47 +00:00
console Avoid 64bit math on MIPS platforms 2014-12-02 01:57:08 +00:00
cpu cbmem: Unify random on-CBMEM-init tasks under common CBMEM_INIT_HOOK() API 2014-12-04 04:01:59 +00:00
device Broadwell FSP: Add new finalize functions for devices and chips 2014-11-20 20:49:36 +00:00
drivers arm, arm64, mips: Add rough static stack size checks with -Wstack-usage 2015-01-21 01:16:47 +00:00
ec chromeec: Add wakeup delay after SPI /CS assertion 2014-10-01 06:53:27 +00:00
include FSP: Properly display the FSP HOB List pointer in the tables 2014-12-12 23:16:17 +00:00
lib arm, arm64, mips: Add rough static stack size checks with -Wstack-usage 2015-01-21 01:16:47 +00:00
mainboard rk3288: Add a config variable hack to skip display init 2015-01-21 01:16:42 +00:00
northbridge cbmem: Unify random on-CBMEM-init tasks under common CBMEM_INIT_HOOK() API 2014-12-04 04:01:59 +00:00
soc rk3288: Add a config variable hack to skip display init 2015-01-21 01:16:42 +00:00
southbridge timestamp: remove conditional #if CONFIG_COLLECT_TIMESTAMPS 2014-11-07 01:24:01 +00:00
superio superio: ite8772f: Exit extemp busy state 2014-09-27 07:09:25 +00:00
vendorcode arm, arm64, mips: Add rough static stack size checks with -Wstack-usage 2015-01-21 01:16:47 +00:00
Kconfig Kconfig: Fix incorrect CONFIG_STACK_SIZE values for X86 and ARM64 2014-12-20 06:35:28 +00:00