making naked attr generally available

Jeffrey A Law law@cygnus.com
Tue Jun 1 02:03:00 GMT 1999


  In message < 19990601004855.B20774@cygnus.com >you write:
  > On Mon, May 31, 1999 at 05:49:32PM -0600, Jeffrey A Law wrote:
  > Phenominaly better than this is to have bits to define special
  > calling conventions for a function.  Something like
No, because that assumes some sane model for function entry.  The whole point
behind not generating any kind of prologue/epilogue is to deal with the insane
cases.

For a non-kernel related application of this feature, look at the major
braindamage we go through in crtstuff.c to make sure that the prologue for
some functions in in one section, while the real code is in another
section.  Ugh!

I can also recall other instances when doing kernel work over the last 10
years where the ability to tailor a prologue or epilogue in assembly but
use normal C code for the body would have made my life a hell of a lot easier.

Consider the case where a return from a function is not accomplished with a
branch, or rfi-like instruction -- say instead the return is accomplished by
setting up a counter to fire off at the next instruction which triggers an
interrupt for your transfer of control (yes, I've really done this kind of
hackery in my deep dark past).

Or what if the exit sequence wants to switch stacks so that the return address
is pulled out of a different stack (I've done this too).

I think there is a place in gcc for both a naked attribute and some way to
specify the precise set of registers one wants to save (for functions which
have prologues).

jeff



More information about the Gcc mailing list