This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C-family stack check for threads


* Florian Weimer:
* Thomas Klein:

e.g. if using "-fstack-check=indirect -fstack-limit-symbol=stack_limit_var"
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.

Regards
  Thomas





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]