Hello,
GCC has a -fstack-limit-register option
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fstack-limit-register
If the ABI has no dedicated register for the stack limit, I guess this
needs to be combined for example with -ffixed-reg. For example on ARM,
we get this code for
int g(void);
int f(void)
{
return g() + g();
}
gcc -O2 -fstack-limit-register=r4 -ffixed-r4 -S -o - test.c
f:
push {r5, lr}
bl g
mov r5, r0
bl g
add r0, r5, r0
pop {r5, lr}
bx lr
The -ffixed-r4 seems to work, but I don't see that the stack limit is
checked. The documentation says: "Generate code to ensure that the stack
does not grow beyond a certain value, either the value of a register or
the address of a symbol."
How is this option supposed to work?
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@xxxxxxxxxxxxxxxxxx
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/