This is the mail archive of the gcc-help@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: is stack-check not implemented for some gcc?


"PRC" <panruochen@gmail.com> writes:

> I want to have a stack overflow check on my program running on MIPS.
> I use the `-fstack-check' option to recompile all the source code. 
> But when I check the objdump file, there doesn't seem that any code relating to
> stack check is generated by gcc. I try again with a i386-redhat-linux gcc on my
> PC, and there is still no stack-check code generated.
> 
> so, I wonder, is stack-check not implemented for mipsel-linux-gcc and 
> i386-redhat-linux-gcc?

What the option does for most targets is insert stack probes at every
page (default: every 4096 bytes) at the start of a function.  This is
only done for functions with large frames.  The code assumes that the
OS has put a guard page at the bottom of the stack.  By inserting
stack probes, it ensures that if you create a very large stack--e.g. a
local "int a[10000]"--you will get a stack overflow warning when
entering the function, rather than letting your code use elements of
the array which may be so large that they pass through your stack into
the stack of another thread.

Ian


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