Re: -fstack-check on MIPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pan ruochen <panruochen@xxxxxxxxx> writes:

> I compile with -fstack-check and check the disassembly file.
> gcc generates a `sw zero,-4392(sp)' instruction before every function call.
> I think -4392(sp) is used as a guard to check if the stack has been overflow
> during the function is executed. What I does not understand is there is not
> a call to ___chkstk on return of the function call. If I miss the chance to
> check the guard word, when the stack check action should be executed? And how
> the check action is invoked?
>
> BTW, I wonder how gcc decides the offset is -4392? Can I change the value by
> some option?

As the documentation of the option says:

     Note that this switch does not actually cause checking to be done;
     the operating system must do that.  The switch causes generation
     of code to ensure that the operating system sees the stack being
     extended.

The store deep in the stack frame is what tells the OS that the stack is
being extended.

There is currently no option to control the default offset to use.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux