__attribute__((naked) on x86 would be useful
Richard Henderson
rth@redhat.com
Mon Feb 16 06:04:00 GMT 2004
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~
More information about the Gcc
mailing list