.. Copyright 1988-2022 Free Software Foundation, Inc. This is part of the GCC manual. For copying conditions, see the copyright.rst file. .. _arc-function-attributes: ARC Function Attributes ^^^^^^^^^^^^^^^^^^^^^^^ These function attributes are supported by the ARC back end: .. index:: interrupt function attribute, ARC .. arc-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. On the ARC, you must specify the kind of interrupt to be handled in a parameter to the interrupt attribute like this: .. code-block:: c++ void f () __attribute__ ((interrupt ("ilink1"))); Permissible values for this parameter are: ``ilink1`` and ``ilink2`` for ARCv1 architecture, and ``ilink`` and ``firq`` for ARCv2 architecture. .. index:: long_call function attribute, ARC, medium_call function attribute, ARC, short_call function attribute, ARC, indirect calls, ARC .. arc-fn-attr:: long_call, medium_call, short_call These attributes specify how a particular function is called. These attributes override the :option:`-mlong-calls` and :option:`-mmedium-calls` (see :ref:`arc-options`) command-line switches and ``#pragma long_calls`` settings. For ARC, a function marked with the :arc-fn-attr:`long_call` attribute is always called using register-indirect jump-and-link instructions, thereby enabling the called function to be placed anywhere within the 32-bit address space. A function marked with the ``medium_call`` attribute will always be close enough to be called with an unconditional branch-and-link instruction, which has a 25-bit offset from the call site. A function marked with the ``short_call`` attribute will always be close enough to be called with a conditional branch-and-link instruction, which has a 21-bit offset from the call site. .. index:: jli_always function attribute, ARC .. arc-fn-attr:: jli_always Forces a particular function to be called using ``jli`` instruction. The ``jli`` instruction makes use of a table stored into ``.jlitab`` section, which holds the location of the functions which are addressed using this instruction. .. index:: jli_fixed function attribute, ARC .. arc-fn-attr:: jli_fixed Identical like the above one, but the location of the function in the ``jli`` table is known and given as an attribute parameter. .. index:: secure_call function attribute, ARC .. arc-fn-attr:: secure_call This attribute allows one to mark secure-code functions that are callable from normal mode. The location of the secure call function into the ``sjli`` table needs to be passed as argument. .. index:: naked function attribute, ARC .. arc-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.