This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: naked function attribute support for Mips
- From: reed kotler <rkotler at mips dot com>
- To: Chung-Ju Wu <jasonwucj at gmail dot com>
- Cc: <gcc at gcc dot gnu dot org>, <rdsandiford at googlemail dot com>
- Date: Fri, 3 May 2013 01:27:06 -0700
- Subject: Re: naked function attribute support for Mips
- References: <5182EA47 dot 2080804 at mips dot com> <CADj25HNcL_5DXjZbWUFgqEotc_cau--+kPi87cCpW3uTKh=f1A at mail dot gmail dot com> <CADj25HOgZi8DQGRsCHwmcXsZZ_rrSzgiT0azoRqB=h6YUBRpQQ at mail dot gmail dot com>
On 05/03/2013 01:06 AM, Chung-Ju Wu wrote:
2013/5/3 Chung-Ju Wu <jasonwucj@gmail.com>:
Or do you think 'naked' is still useful for some other cases in mips porting?
You can implement it and submit the patch to gcc-patches@gcc.gnu.org
and I believe the mips maintainers are willing to have review with you. :)
Oops~ I just noticed that the mips maintainer Richard Sandiford
already had some thought about 'naked' attribute.
Refer to:
http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00660.html
Best regards,
jasonwucj
I think are many valid uses for the naked attribute.
Here is a simple example:
void foo() __attribute__((naked));
void foo() {
#ifdef DEBUG
C code
#else
Production code in assembly
#endif
}
You may have a very different implementation of several or many
functions when the production mode is present but for purely debugging
logic, some C code could be there.
The main idea is that "naked" is there for someone that needs it.
The caller/callee saved register issue is there. In the absence of
additional function attributes, one would presume that normal abi rules
apply. But this issue is there even if you use assembly code instead of
functions with the naked attribute.