This is the mail archive of the
mailing list for the GCC project.
Re: C-family stack check for threads
- From: Thomas Klein <th dot r dot klein at web dot de>
- To: Florian Weimer <fw at deneb dot enyo dot de>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Mar 2011 12:16:07 +0000
- Subject: Re: C-family stack check for threads
- References: <4D86210F.email@example.com> <firstname.lastname@example.org>
* Florian Weimer:
* Thomas Klein:
e.g. if using "-fstack-check=indirect
Have you looked at -fsplit-stack? It emits quite similar code.
Yes I have seen this.
But the switches -fstack-check and -fsplit-stack are for different cases.
The "stack check" (with a given limit) is used to to detect if a stack
overflow has already taken place or if it will take place within the
current function call.
While "split stack" is used to dynamically allocate more space (from
Heap) if the current stack size is too small.
This mechanism is currently only supported for x86 machines (having a
UNIX alike environment).
In my case I'm using a ARM microcontroller (without MMU) with 20KBytes
of RAM in total.
I'm having 10 threads with a 1K stack for each.
Global variables allocating 8K and Heap having 2K.
I simply need a check method to detect if a function is going to write
into the wrong stack area.