This is the mail archive of the
mailing list for the GCC project.
Re: is stack-check not implemented for some gcc?
- From: Ian Lance Taylor <iant at google dot com>
- To: "PRC" <panruochen at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: 09 Nov 2007 08:48:19 -0800
- Subject: Re: is stack-check not implemented for some gcc?
- References: <firstname.lastname@example.org>
"PRC" <email@example.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
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"--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.