Using the "naked" attribute for functions in GCC
Posted
by Art Spasky
on Stack Overflow
See other posts from Stack Overflow
or by Art Spasky
Published on 2010-04-26T21:05:36Z
Indexed on
2010/04/26
22:03 UTC
Read the original article
Hit count: 314
gcc
|attributes
GCC documentation (http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html) states in 6.29 Declaring Attributes of Functions
"naked
Use this attribute on the ARM, AVR, IP2K, RX and SPU ports to indicate that the specified function does not need prologue/epilogue sequences generated by the compiler. It is up to the programmer to provide these sequences. The only statements that can be safely included in naked functions are asm statements that do not have operands. All other statements, including declarations of local variables, if statements, and so forth, should be avoided. Naked functions should be used to implement the body of an assembly function, while allowing the compiler to construct the requisite function declaration for the assembler."
Can I safely call functions using C syntax from naked functions, or only by using asm?
© Stack Overflow or respective owner