lkml.org 
[lkml]   [2009]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: BUG: GCC-4.4.x changes the function frame on some functions


On Thu, 19 Nov 2009, Frederic Weisbecker wrote:
>
> > That way the lr would have the current function, and the parent would
> > still be at 8(%sp)
>
> Yeah right, we need at least such very tiny prologue for
> archs that store return addresses in a reg.

Well, it will be architecture-dependent.

For example, alpha can store the return value in _any_ register if I
recall correctly, so you can do the "call to __fentry__" by just picking
another register than the default one as the return address.

And powerpc has two special registers: link and ctr, but iirc you can only
load 'link' with a branch instruction. Which means that you could do
something like

mflr 0
bl __fentry__

in the caller (I forget if R0 is actually a call-trashed register or not),
and then __fentry__ could do something like

mflr 12 # save _new_ link
mtlr 0 # restore original link
mtctr 12 # move __fentry__ link to ctr
.. do whatever ..
bctr # return to __fentry__ caller

to return with 'link' restored (but ctr and r0/r12 trashed - I don't
recall the ppc calling conventions any more, but I think that is ok).

Saving to stack seems unnecessary and pointless.

Linus


\
 
 \ /
  Last update: 2009-11-19 21:41    [W:0.124 / U:0.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site