This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: noreturn function attribute and ret asm instruction
- From: Jim Wilson <wilson at tuliptree dot org>
- To: Kristis Makris <kristis dot makris at asu dot edu>
- Cc: Zack Weinberg <zack at codesourcery dot com>, gcc-bugs at gcc dot gnu dot org
- Date: 12 Sep 2003 00:10:55 -0700
- Subject: Re: noreturn function attribute and ret asm instruction
- References: <1061654032.13013.9.camel@syd.monet.net><3F4A71EA.40209@tuliptree.org> <1061880472.16160.134.camel@syd.monet.net><87wud0sxtj.fsf@egil.codesourcery.com><1062202145.1918.7.camel@syd.monet.net><1062537266.1047.7.camel@leaf.tuliptree.org> <87isoarh0m.fsf@egil.codesourcery.com> <1063330131.7162.2.camel@syd.monet.net>
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