coreboot/src/lib
Julius Werner 8d8799a33a 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 0.5K 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: Idc53d33bd8487bbef49d3ecd751914b0308006ec
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 8e5931066575e256dfc2295c3dab7f0e1b65417f
Original-Change-Id: I30bd9c2c77e0e0623df89b9e5bb43ed29506be98
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/236978
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9729
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-07-29 20:25:59 +02:00
..
assets.c assets: abstract away the firmware assets used for booting 2015-06-02 14:10:08 +02:00
b64_decode.c lib: add base64 decoder 2015-04-22 08:50:54 +02:00
boot_device.c coreboot: introduce boot_device 2015-05-26 22:32:47 +02:00
bootblock.ld Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
bootmem.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
bootmode.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
cbfs.c cbfs: hardcode file alignment 2015-07-15 16:34:37 +02:00
cbfs_boot_props.c cbfs: hardcode file alignment 2015-07-15 16:34:37 +02:00
cbfs_spi.c cbfs: new API and better program loading 2015-06-02 14:09:31 +02:00
cbmem_common.c cbmem: add indicator to hooks if cbmem is being recovered 2015-06-09 22:03:30 +02:00
cbmem_console.c cbmem: add indicator to hooks if cbmem is being recovered 2015-06-09 22:03:30 +02:00
cbmem_stage_cache.c stage_cache: use cbmem init hooks 2015-06-09 22:06:40 +02:00
compute_ip_checksum.c lib: Fix spelling 2013-07-10 20:17:51 +02:00
coreboot_table.c cbtable: describe boot media 2015-07-14 22:36:43 +02:00
debug.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
delay.c
edid.c Unify byte order macros and clrsetbits 2015-04-21 08:23:25 +02:00
ext_stage_cache.c stage_cache: use cbmem init hooks 2015-06-09 22:06:40 +02:00
fallback_boot.c lib: Add Kconfig option to enable/disable auto fallback control 2015-03-17 04:22:23 +01:00
fmap.c fmap: publish find_fmap_directory() 2015-07-14 15:48:54 +02:00
gcc.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
gcov-glue.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
gcov-io.c Implement GCC code coverage analysis 2013-01-12 19:09:55 +01:00
gcov-io.h lib: Fix spelling 2013-07-10 20:17:51 +02:00
gcov-iov.h Implement GCC code coverage analysis 2013-01-12 19:09:55 +01:00
generic_dump_spd.c misc: Drop print_ implementation from non-romcc boards 2015-01-09 06:12:22 +01:00
generic_sdram.c misc: Drop print_ implementation from non-romcc boards 2015-01-09 06:12:22 +01:00
gpio.c arm, arm64, mips: Add rough static stack size checks with -Wstack-usage 2015-07-29 20:25:59 +02:00
halt.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
hardwaremain.c hardwaremain: Move init_timer() call to before console init 2015-06-30 08:11:16 +02:00
hexdump.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
imd.c imd: don't recover on limit == 0 2015-05-11 22:39:13 +02:00
imd_cbmem.c cbmem: add indicator to hooks if cbmem is being recovered 2015-06-09 22:03:30 +02:00
jpeg.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
jpeg.h Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
libgcc.c lib: Unify log2() and related functions 2015-06-05 13:18:55 +02:00
libgcov.c Fix whitespace leaked into tree 2013-09-17 21:04:35 +02:00
lzma.c lzma: Return correct amount of decompressed bytes 2015-07-06 09:40:37 +02:00
lzmadecode.c RISCV: get RISCV to build again 2014-12-04 19:17:51 +01:00
lzmadecode.h Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
Makefile.inc lib: add delay.c to bootblock if I2C_TPM driver is enabled 2015-06-30 08:19:50 +02:00
malloc.c Remove leftover smi_get_tseg_base 2015-05-29 07:06:37 +02:00
mem_pool.c coreboot: add memory pool infrastructure 2015-05-14 17:27:09 +02:00
memchr.c Add an implementation for the memchr library function 2012-03-09 20:00:53 +01:00
memcmp.c
memcpy.c fix compiler warnings (trivial) 2009-01-20 21:40:16 +00:00
memmove.c
memrange.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
memset.c fix compiler warnings (trivial) 2009-01-20 21:40:16 +00:00
mocked_tlcl.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
primitive_memtest.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
prog_loaders.c prog_loader: Play nice with gc-sections 2015-06-26 22:43:46 +02:00
prog_ops.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
ramstage.ld Change #ifdef and #if defined CONFIG_ bools to #if IS_ENABLED() 2015-07-12 18:14:23 +02:00
ramtest.c misc: Drop print_ implementation from non-romcc boards 2015-01-09 06:12:22 +01:00
reg_script.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
region.c regions: add more helpers 2015-05-19 10:36:43 +02:00
rmodule.c assets: abstract away the firmware assets used for booting 2015-06-02 14:10:08 +02:00
rmodule.ld Change #ifdef and #if defined CONFIG_ bools to #if IS_ENABLED() 2015-07-12 18:14:23 +02:00
romstage.ld linker scripts: Fix symbol handling for pre-RAM cbmem console 2015-07-01 22:03:21 +02:00
selfboot.c assets: abstract away the firmware assets used for booting 2015-06-02 14:10:08 +02:00
stack.c arm: Fix checkstack() to use correct stack size 2015-04-14 09:04:04 +02:00
thread.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
timer.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
timer_queue.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
timestamp.c timestamps: clarify in ramstage when not to reinit the cache 2015-07-14 22:50:37 +02:00
tlcl.c chromeos: vboot2: Add TPM PCR extension support 2015-04-20 17:06:28 +02:00
tlcl_internal.h vboot2: read secdata and nvdata 2015-03-23 19:51:47 +01:00
tlcl_structures.h vboot2: copy tlcl from vboot_reference as a preparation for vboot2 integration 2015-01-27 01:43:57 +01:00
tpm_error_messages.h TPM: Fix whitespace 2015-02-06 00:25:59 +01:00
trace.c Remove address from GPLv2 headers 2015-05-21 20:50:25 +02:00
version.c build.h: remove variable for the builduser, -hostname and -domain 2015-03-09 17:53:16 +01:00