__attribute__((naked) on x86 would be useful

Richard Earnshaw rearnsha@arm.com
Mon Feb 16 11:44:00 GMT 2004


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

I agree:  "naked" is an abomination. 

I wonder whether we should add a new type of asm -- asm_function?  
Something like

asm_function (func_name, "<asm-body>");

which can only be used at the top level.  GCC could then do what it does 
with naked, but the user can't break the limitations as they can with 
naked.

Once we have something like that we could deprecate naked and start the 
process of recovering from that mess.

R.



More information about the Gcc mailing list