__attribute__((interrupt("type"))) function attribute
This attribute instructs the compiler to generate a function in a manner that is suitable for use as an exception handler.
is one of the following:
This attribute affects the code generation of a function as follows:
- If the function is AAPCS, the stack is realigned to 8 bytes on entry.
For processors that are not based on the M-profile, preserves all processor registers, rather than only the registers that the AAPCS requires to be preserved. Floating-point registers are not preserved.
For processors that are not based on the M-profile, the function returns using an instruction that is architecturally defined as a return from exception.
- No arguments or return values can be used with the functions.
- The functions are incompatible with
In Armv6‑M, Armv7‑M, and Armv8‑M, the architectural exception handling mechanism preserves all processor registers, and a standard function return can cause an exception return. Therefore, specifying this attribute does not affect the behavior of the compiled output. However, Arm recommends using this attribute on exception handlers for clarity and easier software porting.
For architectures that support A32 and T32 instructions, functions specified with this attribute compile to A32 or T32 code depending on whether the compile option specifies A32 code or T32 code.
For T32 only architectures, for example the Armv6‑M architecture, functions specified with this attribute compile to T32 code.
- This attribute is not available for A64 code.