[cfe-dev] naked attribute

reed kotler rkotler at mips.com
Fri May 3 09:32:36 PDT 2013


On 05/03/2013 04:57 AM, Rafael EspĂ­ndola wrote:
>> Gah! No, I see the warning now. Blasted black-and-white diagnostics.
>> Sorry about all the confusion I've caused.
> I did the same :-(
>
> Cool, of the support architectures on clang so far we have
>
> x86-64: warn (except for windows)
> x86:     warn  (except for windows)
> arm:     produce a function ending in unreachable (can someone check
> if that is the case for thumb too?)
> arm64:  warn
>
Just when things seemed simple....

With gcc, the mips target does not support, as I understand it, this 
because the Mips maintainer does not like this attribute, in general, 
not specifically for Mips.

I would like to see this option available for Mips, even if it meant 
having a command line option, -allow-naked so that strict gcc 
compatibility is preserved. There could be benign "naked" attributes on 
some functions in a C programs being compiled for Mips  that are now 
being ignored and suddenly we allow it and that code breaks; maybe even 
in subtle cases because the program is not saving and restoring callee 
saved registers for example.

I have reopened this discussion on the gcc developers list and there is 
a lot of interest in it. Anyone from llvm/clang can follow it there.

There is another orthogonal discussion, with various opposing opinions, 
taking place in Mips/Imagination on this.

For the sake of the greater community of Mips target users, which is 
beyond whatever opinions gcc has or Mips has internally, I think this 
important option should be allowed in some form. Others in gcc land 
agree with me on this have good experience using it for the Arm platform.

It's not needed all the time but when you need, you can't easily do 
without it.

For one, you can include whatever little actual assembly code you need 
for your app in the C/C++ code. This is particularly important for 
embedded targets.

My immediate interest in this is that I'm generating stubs for various 
things in the Mips llvm/compiler and I wanted exactly the semantics of 
the naked attribute for those stubs; though I could invent my own 
attribute to use internally in the compiler.

Reed

>> Tim.
> Cheers,
> Rafael





More information about the cfe-dev mailing list