[cfe-dev] naked attribute

Reed Kotler rkotler at mips.com
Fri May 3 10:15:40 PDT 2013


On 05/03/2013 09:43 AM, Hal Finkel wrote:
> ----- Original Message -----
>> From: "reed kotler" <rkotler at mips.com>
>> To: "Rafael EspĂ­ndola" <rafael.espindola at gmail.com>
>> Cc: cfe-dev at cs.uiuc.edu
>> Sent: Friday, May 3, 2013 11:32:36 AM
>> Subject: Re: [cfe-dev] naked attribute
>>
>> 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....
>
> FWIW, I think that we should support naked functions on all targets, regardless of what gcc does. They are incredibly convenient for doing OS/embedded development. Is there a downside?
>
>   -Hal
>

I agree. At least in the clang/llvm mode where we don't care about 
strict compatibility with gcc.

For the serious  embedded programmer, this is a life saver and helpful 
friend.

>>
>> 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
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>





More information about the cfe-dev mailing list