public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* is stack-check not implemented for some gcc?
@ 2007-11-08  9:30 PRC
  2007-11-09 19:56 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: PRC @ 2007-11-08  9:30 UTC (permalink / raw)
  To: gcc-help

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: is stack-check not implemented for some gcc?
  2007-11-08  9:30 is stack-check not implemented for some gcc? PRC
@ 2007-11-09 19:56 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2007-11-09 19:56 UTC (permalink / raw)
  To: PRC; +Cc: gcc-help

"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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-09 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08  9:30 is stack-check not implemented for some gcc? PRC
2007-11-09 19:56 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).