gcc: add options to limit large object and stack usage
authorTao Zeng <tao.zeng@amlogic.com>
Mon, 4 Sep 2017 03:07:03 +0000 (11:07 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 5 Sep 2017 07:13:46 +0000 (00:13 -0700)
commit587e8e99f733756eb643096616c66a924c9a6070
tree144d70ce6af2af25bd855df23c03d9e993982fb2
parent24963847bf1619fa8a284f321a5fedc3ee43a0c2
gcc: add options to limit large object and stack usage

PD#150373: gcc: add options to limit large object and stack usage

We should restrict limit large size of global object allocated in
driver code to reduce size of .data/.bss/.rodata sections. Also,
large array/many variables declared in a function is not allowed,
this behavior may cause kernel stack overflow especially in IRQ
context or recursion calls.
Right now we just set a very high limit in order to pass comiple.
Final target is to limit:

1. large global object size should not over 4096 bytes, a page size;
2. stack usage of each function should not over 256 bytes.

If your global object is larger than a page size, we advise allocate
it as a static pointer, and allocate it's memory during probe stage.

Change-Id: Ic14995f642bc1e0b47d3a07143468e6e1dac7bfc
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
drivers/amlogic/Makefile
drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd_intr.c
sound/soc/amlogic/Makefile
sound/soc/codecs/amlogic/Makefile