Am 05/16/2014 07:16 PM, schrieb Carlos O'Donell:
On 05/12/2014 11:13 PM, David Wohlferd wrote:
After updating gcc's docs about inline asm, I'm trying to improve
some of the related sections. One that I feel has problems with
clarity is __attribute__ naked.
I have attached my proposed update. Comments/corrections are
welcome.
In a related question:
To better understand how this attribute is used, I looked at the
Linux kernel. While the existing docs say "only ... asm statements
that do not have operands" can safely be used, Linux routinely uses
asm WITH operands.
That's a bug. Period. You must not use naked with an asm that has
operands. Any kind of operand might inadvertently cause the compiler
to generate code and that would violate the requirements of the
attribute and potentially generate an ICE.
There is target hook TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS that is intended to
cater that case. For example, the documentation indicates it only works with
optimization turned off. But I don't know how reliable it is in general. For
avr target it works as expected.
https://gcc.gnu.org/onlinedocs/gccint/Misc.html#index-TARGET_005fALLOCATE_005fSTACK_005fSLOTS_005fFOR_005fARGS-4969
Johann