noreturn function attribute and ret asm instruction

Jim Wilson wilson@tuliptree.org
Fri Sep 12 07:10:00 GMT 2003


On Thu, 2003-09-11 at 18:29, Kristis Makris wrote:
> On the same note, is there any way to tell gcc that it should create
> code for a function that will leave the state of the registers exactly
> as it was originally when the function was entered ?

No.  If you are trying to write assembly language code, then write
assembly language code not C code with asms.

Some targets have an "interrupt" attribute that can be used to write
functions called by interrupt handlers.  They work a bit like this, in
that they have to save/restore all of the call clobbered registers. 
This doesn't necessarily do what you want though, for instance, you will
get a return from interrupt instruction at the end of the function
instead of a normal return instruction.  And your target may not have
support for this attribute.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc-bugs mailing list