doc: Consolidate documentation for naked attribute [PR88472]

This attribute has been documented similarly in the sections for 12
different targets.  I think it's time to promote this to a common
attribute and document it only once with a warning that it's not
supported everywhere.

gcc/ChangeLog
	PR other/88472
	* doc/extend.texi (Common Attributes): Document the "naked"
	attribute here.
	(ARC Attributes): Delete entry for "naked".
	(ARM Attributes): Likewise.
	(AVR Attributes): Likewise.
	(BPF Attributes): Likewise.
	(C-SKY Attributes): Likewise.
	(MCORE Attributes): Delete entire section since "naked" was
	the only thing listed.
	(MSP430 Attributes): Delete entry for "naked".
	(NDS32 Attributes): Likewise.
	(RISC-V Attributes): Likewise.
	(RL78 Attributes): Likewise.
	(RX Attributes): Likewise.
	(x86 Attributes): Likewise.
This commit is contained in:
Sandra Loosemore
2026-02-19 18:26:32 +00:00
parent fe41e09d9d
commit 991a62f5b6

View File

@@ -3511,6 +3511,22 @@ It is not possible to avoid the warning in this way if the maybe-escaped
variable is a function argument, because those are in scope
for the whole function.
@cindex @code{naked} function attribute
@item naked
This attribute applies to functions.
It allows the compiler to construct the requisite function
declaration, while allowing the body of the function to be assembly
code. The specified function does not have prologue/epilogue
sequences generated by the compiler. Only basic @code{asm} statements
can safely be included in naked functions (@pxref{Basic Asm}). While
using extended @code{asm} or a mixture of basic @code{asm} and C code
may appear to work, they cannot be depended upon to work reliably and
are not supported.
Not all targets support this attribute. Those that do include ARC, ARM,
AVR, BPF, C-SKY, MCORE, MSP430, NDS32, RISC-V, RL78, RX, and x86.
@cindex @code{no_icf} attribute
@item no_icf
This attribute can be applied to functions or variables.
@@ -5573,7 +5589,6 @@ The default for the attribute is controlled by @option{-fzero-call-used-regs}.
* M32C Attributes::
* M32R/D Attributes::
* m68k Attributes::
* MCORE Attributes::
* MicroBlaze Attributes::
* Microsoft Windows Attributes::
* MIPS Attributes::
@@ -5981,19 +5996,6 @@ It allows you to mark secure-code functions that are
callable from normal mode. The location of the secure call function
into the @code{sjli} table needs to be passed as argument.
@cindex @code{naked} function attribute, ARC
@item naked
This attribute applies to functions.
It allows the compiler to construct the requisite function
declaration, while allowing the body of the function to be assembly
code. The specified function does not have prologue/epilogue
sequences generated by the compiler. Only basic @code{asm} statements
can safely be included in naked functions (@pxref{Basic Asm}). While
using extended @code{asm} or a mixture of basic @code{asm} and C code
may appear to work, they cannot be depended upon to work reliably and
are not supported.
@cindex @code{aux} variable attribute, ARC
@item aux
This attribute applies to variables.
@@ -6079,19 +6081,6 @@ calling sequence. The @code{short_call} attribute always places
the offset to the function from the call site into the @samp{BL}
instruction directly.
@cindex @code{naked} function attribute, ARM
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{pcs} function attribute, ARM
@item pcs
This attribute applies to functions.
@@ -6315,19 +6304,6 @@ and @code{noblock} together has the same effect like using the @code{interrupt}
attribute. Using the @code{noblock} attribute without @code{signal} has no
effect.
@cindex @code{naked} function attribute, AVR
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{no_gccisr} function attribute, AVR
@item no_gccisr
This attribute applies to functions.
@@ -6697,19 +6673,6 @@ int bpf_probe_read (void *dst, int size, const void *unsafe_ptr)
__attribute__ ((kernel_helper (4)));
@end smallexample
@cindex @code{naked} function attribute, BPF
@item naked
This attribute applies to functions.
It allows the compiler to construct the requisite function
declaration, while allowing the body of the function to be assembly
code. The specified function does not have prologue/epilogue
sequences generated by the compiler. Only basic @code{asm} statements
can safely be included in naked functions (@pxref{Basic Asm}). While
using extended @code{asm} or a mixture of basic @code{asm} and C code
may appear to work, they cannot be depended upon to work reliably and
are not supported.
@cindex @code{preserve_access_index} type attribute, BPF
@item preserve_access_index
This attribute applies to types.
@@ -6743,19 +6706,6 @@ use in an interrupt handler when either of these attributes are present.
Use of these options requires the @option{-mistack} command-line option
to enable support for the necessary interrupt stack instructions. They
are ignored with a warning otherwise. @xref{C-SKY Options}.
@cindex @code{naked} function attribute, C-SKY
@item naked
This attribute applies to functions.
This attribute allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@end table
@@ -7429,26 +7379,6 @@ sequences and replaces the return instruction with a @code{sleep}
instruction. This attribute is available only on fido.
@end table
@node MCORE Attributes
@subsubsection MCORE Attributes
These attributes are supported by the MCORE back end:
@table @code
@cindex @code{naked} function attribute, MCORE
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@end table
@node MicroBlaze Attributes
@subsubsection MicroBlaze Attributes
@@ -7854,19 +7784,6 @@ match up with appropriate entries in the linker script. By default
the names @code{watchdog} for vector 26, @code{nmi} for vector 30 and
@code{reset} for vector 31 are recognized.
@cindex @code{naked} function attribute, MSP430
@item naked
This attribute applies to functions.
This attribute allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{reentrant} function attribute, MSP430
@item reentrant
This attribute applies to functions.
@@ -7979,19 +7896,6 @@ The system will help save caller registers into stack before entering
interrupt handler.
@end table
@cindex @code{naked} function attribute, NDS32
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{reset} function attribute, NDS32
@cindex reset handler functions
@item reset
@@ -8273,19 +8177,6 @@ These attributes mainly are intended to support the @code{__vector},
These attributes are supported by the RISC-V back end:
@table @code
@cindex @code{naked} function attribute, RISC-V
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{interrupt} function attribute, RISC-V
@item interrupt
This attribute applies to functions.
@@ -8415,19 +8306,6 @@ Use @code{brk_interrupt} instead of @code{interrupt} for
handlers intended to be used with the @code{BRK} opcode (i.e.@: those
that must end with @code{RETB} instead of @code{RETI}).
@cindex @code{naked} function attribute, RL78
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{saddr} variable attribute, RL78
@item saddr
This attribute applies to variables.
@@ -8484,19 +8362,6 @@ void __attribute__ ((interrupt (RXD1_VECT,RXD2_VECT,"dct","$default")))
txd1_handler ();
@end smallexample
@cindex @code{naked} function attribute, RX
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{vector} function attribute, RX
@item vector
This attribute applies to functions.
@@ -8818,19 +8683,6 @@ this function attribute to make GCC generate the ``hot-patching'' function
prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2
and newer.
@cindex @code{naked} function attribute, x86
@item naked
This attribute applies to functions.
It allows the compiler to construct the
requisite function declaration, while allowing the body of the
function to be assembly code. The specified function does not have
prologue/epilogue sequences generated by the compiler. Only basic
@code{asm} statements can safely be included in naked functions
(@pxref{Basic Asm}). While using extended @code{asm} or a mixture of
basic @code{asm} and C code may appear to work, they cannot be
depended upon to work reliably and are not supported.
@cindex @code{regparm} function attribute, x86
@cindex functions that are passed arguments in registers on x86-32
@item regparm (@var{number})