• Dimitris Lampridis's avatar
    [sw][kernel] respect stack frame limit · cb7400a1
    Dimitris Lampridis authored
    spec_fpga_app_init() declares too many local buffers that are allocated on the stack.
    
    On some versions of GCC this is detected and reported, causing a warning that is promoted to an
    error. Example:
    
    spec-core-fpga.c:792:1: error: the frame size of 1888 bytes is larger than 1024 bytes
    [-Werror=frame-larger-than=]
    
    Since apparently it is not a very good idea to increase the stack frame size limit [1], the solution
    implemented here is to switch to dynimically allocating the biggest buffer (struct resource res[]).
    
    [1]: https://gcc.gnu.org/onlinedocs/gccint/Stack-Checking.html#Stack-Checking
    "The maximum size of a stack frame, in bytes. GCC will generate probe instructions in non-leaf
    functions to ensure at least this many bytes of stack are available. If a stack frame is larger than
    this size, stack checking will not be reliable and GCC will issue a warning. The default is chosen
    so that GCC only generates one instruction on most systems. You should normally not change the
    default value of this macro."
    Signed-off-by: Dimitris Lampridis's avatarDimitris Lampridis <dimitris.lampridis@cern.ch>
    cb7400a1
spec-core-fpga.c 23.7 KB