Commit 3a96c7cc by David Wohlferd Committed by Gerald Pfeifer

extend.texi (Function Attributes): Update 'naked' attribute documentation.

	* doc/extend.texi (Function Attributes): Update 'naked' attribute
	documentation.

From-SVN: r212128
parent dabb1a20
2014-06-29 David Wohlferd <dw@LimeGreenSocks.com>
* doc/extend.texi (Function Attributes): Update 'naked' attribute
documentation.
2014-06-29 Tobias Grosser <tobias@grosser.es> 2014-06-29 Tobias Grosser <tobias@grosser.es>
PR bootstrap/61650 PR bootstrap/61650
......
...@@ -3358,16 +3358,15 @@ allowed value is 1000000. ...@@ -3358,16 +3358,15 @@ allowed value is 1000000.
@item naked @item naked
@cindex function without a prologue/epilogue code @cindex function without a prologue/epilogue code
Use this attribute on the ARM, AVR, MCORE, MSP430, NDS32, RL78, RX and SPU This attribute is available on the ARM, AVR, MCORE, MSP430, NDS32,
ports to indicate that the specified function does not need prologue/epilogue RL78, RX and SPU ports. It allows the compiler to construct the
sequences generated by the compiler. requisite function declaration, while allowing the body of the
It is up to the programmer to provide these sequences. The function to be assembly code. The specified function will not have
only statements that can be safely included in naked functions are prologue/epilogue sequences generated by the compiler. Only Basic
@code{asm} statements that do not have operands. All other statements, @code{asm} statements can safely be included in naked functions
including declarations of local variables, @code{if} statements, and so (@pxref{Basic Asm}). While using Extended @code{asm} or a mixture of
forth, should be avoided. Naked functions should be used to implement the Basic @code{asm} and ``C'' code may appear to work, they cannot be
body of an assembly function, while allowing the compiler to construct depended upon to work reliably and are not supported.
the requisite function declaration for the assembler.
@item near @item near
@cindex functions that do not handle memory bank switching on 68HC11/68HC12 @cindex functions that do not handle memory bank switching on 68HC11/68HC12
...@@ -6304,6 +6303,8 @@ Using Extended @code{asm} will typically produce smaller, safer, and more ...@@ -6304,6 +6303,8 @@ Using Extended @code{asm} will typically produce smaller, safer, and more
efficient code, and in most cases it is a better solution. When writing efficient code, and in most cases it is a better solution. When writing
inline assembly language outside of C functions, however, you must use Basic inline assembly language outside of C functions, however, you must use Basic
@code{asm}. Extended @code{asm} statements have to be inside a C function. @code{asm}. Extended @code{asm} statements have to be inside a C function.
Functions declared with the @code{naked} attribute also require Basic
@code{asm} (@pxref{Function Attributes}).
Under certain circumstances, GCC may duplicate (or remove duplicates of) your Under certain circumstances, GCC may duplicate (or remove duplicates of) your
assembly code when optimizing. This can lead to unexpected duplicate assembly code when optimizing. This can lead to unexpected duplicate
...@@ -6423,6 +6424,8 @@ programs. ...@@ -6423,6 +6424,8 @@ programs.
Note that Extended @code{asm} statements must be inside a function. Only Note that Extended @code{asm} statements must be inside a function. Only
Basic @code{asm} may be outside functions (@pxref{Basic Asm}). Basic @code{asm} may be outside functions (@pxref{Basic Asm}).
Functions declared with the @code{naked} attribute also require Basic
@code{asm} (@pxref{Function Attributes}).
While the uses of @code{asm} are many and varied, it may help to think of an While the uses of @code{asm} are many and varied, it may help to think of an
@code{asm} statement as a series of low-level instructions that convert input @code{asm} statement as a series of low-level instructions that convert input
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment