This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __attribute__((naked) on x86 would be useful
- From: Richard Henderson <rth at redhat dot com>
- To: Mat Hostetter <mat at curl dot com>
- Cc: gcc at gnu dot org
- Date: Sun, 15 Feb 2004 22:00:19 -0800
- Subject: Re: __attribute__((naked) on x86 would be useful
- References: <qtwn07jhghr.fsf@unicron.curl.com>
On Sun, Feb 15, 2004 at 10:04:32PM -0500, Mat Hostetter wrote:
> 1) Boilerplate. If you look at gcc's assembly output, each proc has
> 2) Name mangling. Some systems put a leading underscore in
> 3) Section lossage. The last time I checked, gcc seems to remember
Then why don't you just write in C? Certainly it means you have to
track fewer things across different platforms. Indeed, suddenly things
would start to work on non-x86 platforms. Gasp.
Certainly the compiler can handle this ---
> My main use for this is for some small
> machine-generated assembly language trampolines that implement
> multiple inheritance (e.g. offset a "self" parameter and jump
> elsewhere)...
all by itself at -O2.
The largest mistake with "naked" is that if you write *any* non
asm code at all in the function, then it won't work. I might have
seen the rationale for accepting exactly one old-style asm in a
"naked" function, and emitting nothing else, but that's not the
way that attribute has typically been enforced.
In any case, there's still zero chance that such a patch will be
written or accepted.
r~