This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: making naked attr generally available


On Tue, Jun 01, 1999 at 02:59:33AM -0600, Jeffrey A Law wrote:
> 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.

The thing is, I don't believe you _can_ handle the insane cases
with naked functions.  So you'll fiddle around with the beginning
asm block for a while and get it to work, and then the next 
compiler rev optimizes slightly differently and your code breaks.

> 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!

An extremely rare example that does make a tiny amount of sense.

And guess what -- later ELF revisions added DT_INIT_ARRAY so that
there would be no need to glom function parts together like that.
On targets that support DT_INIT_ARRAY, we can directly support
.ctors without a __do_global_ctors_aux function, and without all
the .init/.fini grossness you mention.

> 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).

Custom exit sequences are easy.  You just do them and ignore the 
compiler's version.  What's impossible is for the user to know how
much stack space the compiler wants to do it's job, or to know which
registers the compiler is going to want to use.

I have strong reservations about turning such a feature loose.
There is no way we can explain how you can and cannot use the
feature.  Code _will_ break from one compiler rev to the next.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]