]> git.ipfire.org Git - thirdparty/gcc.git/blob
3cc2700bffebc59e7f9d6e1a984bf902d8bbaa68
[thirdparty/gcc.git] /
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. _arc-function-attributes:
7
8 ARC Function Attributes
9 ^^^^^^^^^^^^^^^^^^^^^^^
10
11 These function attributes are supported by the ARC back end:
12
13 .. index:: interrupt function attribute, ARC
14
15 .. arc-fn-attr:: interrupt
16
17 Use this attribute to indicate
18 that the specified function is an interrupt handler. The compiler generates
19 function entry and exit sequences suitable for use in an interrupt handler
20 when this attribute is present.
21
22 On the ARC, you must specify the kind of interrupt to be handled
23 in a parameter to the interrupt attribute like this:
24
25 .. code-block:: c++
26
27 void f () __attribute__ ((interrupt ("ilink1")));
28
29 Permissible values for this parameter are: ``ilink1`` and
30 ``ilink2`` for ARCv1 architecture, and ``ilink`` and
31 ``firq`` for ARCv2 architecture.
32
33 .. index:: long_call function attribute, ARC, medium_call function attribute, ARC, short_call function attribute, ARC, indirect calls, ARC
34
35 .. arc-fn-attr:: long_call, medium_call, short_call
36
37 These attributes specify how a particular function is called.
38 These attributes override the
39 :option:`-mlong-calls` and :option:`-mmedium-calls` (see :ref:`arc-options`)
40 command-line switches and ``#pragma long_calls`` settings.
41
42 For ARC, a function marked with the :arc-fn-attr:`long_call` attribute is
43 always called using register-indirect jump-and-link instructions,
44 thereby enabling the called function to be placed anywhere within the
45 32-bit address space. A function marked with the ``medium_call``
46 attribute will always be close enough to be called with an unconditional
47 branch-and-link instruction, which has a 25-bit offset from
48 the call site. A function marked with the ``short_call``
49 attribute will always be close enough to be called with a conditional
50 branch-and-link instruction, which has a 21-bit offset from
51 the call site.
52
53 .. index:: jli_always function attribute, ARC
54
55 .. arc-fn-attr:: jli_always
56
57 Forces a particular function to be called using ``jli``
58 instruction. The ``jli`` instruction makes use of a table stored
59 into ``.jlitab`` section, which holds the location of the functions
60 which are addressed using this instruction.
61
62 .. index:: jli_fixed function attribute, ARC
63
64 .. arc-fn-attr:: jli_fixed
65
66 Identical like the above one, but the location of the function in the
67 ``jli`` table is known and given as an attribute parameter.
68
69 .. index:: secure_call function attribute, ARC
70
71 .. arc-fn-attr:: secure_call
72
73 This attribute allows one to mark secure-code functions that are
74 callable from normal mode. The location of the secure call function
75 into the ``sjli`` table needs to be passed as argument.
76
77 .. index:: naked function attribute, ARC
78
79 .. arc-fn-attr:: naked
80
81 This attribute allows the compiler to construct the requisite function
82 declaration, while allowing the body of the function to be assembly
83 code. The specified function will not have prologue/epilogue
84 sequences generated by the compiler. Only basic ``asm`` statements
85 can safely be included in naked functions (see :ref:`basic-asm`). While
86 using extended ``asm`` or a mixture of basic ``asm`` and C code
87 may appear to work, they cannot be depended upon to work reliably and
88 are not supported.