.. Copyright 1988-2022 Free Software Foundation, Inc. This is part of the GCC manual. For copying conditions, see the copyright.rst file. .. _risc-v-function-attributes: RISC-V Function Attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^ These function attributes are supported by the RISC-V back end: .. index:: naked function attribute, RISC-V .. risc-v-fn-attr:: naked 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 ``asm`` statements can safely be included in naked functions (see :ref:`basic-asm`). While using extended ``asm`` or a mixture of basic ``asm`` and C code may appear to work, they cannot be depended upon to work reliably and are not supported. .. index:: interrupt function attribute, RISC-V .. risc-v-fn-attr:: interrupt 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: .. code-block:: c++ void f (void) __attribute__ ((interrupt ("user"))); Permissible values for this parameter are ``user``, ``supervisor``, and ``machine``. If there is no parameter, then it defaults to ``machine``.