6.31.4. ARM Function Attributes
6.31.4 ARM Function Attributes
These function attributes are supported for ARM targets:
Use this attribute to indicate that the specified function is an interrupt handler. The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.
You can specify the kind of interrupt to be handled by adding an optional parameter to the interrupt attribute like this:
void f () __attribute__ ((interrupt ("IRQ")));
Permissible values for this parameter are:
On ARMv7-M the interrupt type is ignored, and the attribute means the function may be called with a word-aligned stack pointer.
Use this attribute on ARM to write Interrupt Service Routines. This is an alias to the
These attributes specify how a particular function is called. These attributes override the -mlong-calls (see ARM Options) command-line switch and
#pragma long_callssettings. For ARM, the
long_callattribute indicates that the function might be far away from the call site and require a different (more expensive) calling sequence. The
short_callattribute always places the offset to the function from the call site into the ‘BL’ instruction directly.
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 will not have prologue/epilogue sequences generated by the compiler. Only basic
asmstatements can safely be included in naked functions (see Basic Asm). While using extended
asmor a mixture of basic
asmand C code may appear to work, they cannot be depended upon to work reliably and are not supported.
pcsattribute can be used to control the calling convention used for a function on ARM. The attribute takes an argument that specifies the calling convention to use.
When compiling using the AAPCS ABI (or a variant of it) then valid values for the argument are
"aapcs-vfp". In order to use a variant other than
"aapcs"then the compiler must be permitted to use the appropriate co-processor registers (i.e., the VFP registers must be available in order to use
"aapcs-vfp"). For example,
/* Argument passed in r0, and result returned in r0+r1. */ double f2d (float) __attribute__((pcs("aapcs")));
Variadic functions always use the
"aapcs"calling convention and the compiler rejects attempts to specify an alternative.
As discussed in Common Function Attributes, this attribute allows specification of target-specific compilation options.
On ARM, the following options are allowed:
Force code generation in the Thumb (T16/T32) ISA, depending on the architecture level.
Force code generation in the ARM (A32) ISA.
Functions from different modes can be inlined in the caller’s mode.
Specifies the fpu for which to tune the performance of this function. The behavior and permissible arguments are the same as for the -mfpu= command-line option.
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.