__check_stack and 'ip'

Alex Waugh alex at alexwaugh.com
Mon Dec 30 04:05:19 PST 2002


In message <3E0FB29F.5090101 at dsvr.net>
          Nick Burrett <nick at dsvr.net> wrote:

> I'm concerned about the use of 'ip' within sys/_syslib.s::__check_stack.
> 
> AFAICT, the stack frame setup should not be strictly APCS compilant, 
> since the __rt_stkovf_split_{small,big} functions aren't.
> 
> The problem I'm seeing is that __check_stack is corrupting 'ip' which 
> GCC is using to pass a static chain reference for nested functions.  I 
> could adjust GCC to pass the static chain in a different register, but 
> I'm hoping not to, since it is easy to just fix __check_stack.
> 
> Fixing __check_stack is easy, but I'm wondering whether the 
> SharedCLibrary guarantees that 'ip' is preserved during stack extension. 
>   Does anybody know ?

I can't see any definitive statement in the PRM. I've just written a
quick test program, and __rt_stkovf_split_small in the scl corrupts ip.
I haven't tried __rt_stkovf_split_big but as ip is an input parameter for
this I can't see how preserving it would help.

Alex

-- 
Alex Waugh                                           alex at alexwaugh.com

PHP, Roots, Subversion, WebJames and more from http://www.alexwaugh.com/



More information about the gcc mailing list