]> git.ipfire.org Git - thirdparty/gcc.git/blob
6efe42f3515e8b3e2829fa1821e1d88289237dce
[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 .. _exception-region-output:
7
8 Assembler Commands for Exception Regions
9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10
11 .. prevent bad page break with this line
12
13 This describes commands marking the start and the end of an exception
14 region.
15
16 .. c:macro:: EH_FRAME_SECTION_NAME
17
18 If defined, a C string constant for the name of the section containing
19 exception handling frame unwind information. If not defined, GCC will
20 provide a default definition if the target supports named sections.
21 :samp:`crtstuff.c` uses this macro to switch to the appropriate section.
22
23 You should define this symbol if your target supports DWARF 2 frame
24 unwind information and the default definition does not work.
25
26 .. c:macro:: EH_FRAME_THROUGH_COLLECT2
27
28 If defined, DWARF 2 frame unwind information will identified by
29 specially named labels. The collect2 process will locate these
30 labels and generate code to register the frames.
31
32 This might be necessary, for instance, if the system linker will not
33 place the eh_frames in-between the sentinals from :samp:`crtstuff.c`,
34 or if the system linker does garbage collection and sections cannot
35 be marked as not to be collected.
36
37 .. c:macro:: EH_TABLES_CAN_BE_READ_ONLY
38
39 Define this macro to 1 if your target is such that no frame unwind
40 information encoding used with non-PIC code will ever require a
41 runtime relocation, but the linker may not support merging read-only
42 and read-write sections into a single read-write section.
43
44 .. c:macro:: MASK_RETURN_ADDR
45
46 An rtx used to mask the return address found via ``RETURN_ADDR_RTX``, so
47 that it does not contain any extraneous set bits in it.
48
49 .. c:macro:: DWARF2_UNWIND_INFO
50
51 Define this macro to 0 if your target supports DWARF 2 frame unwind
52 information, but it does not yet work with exception handling.
53 Otherwise, if your target supports this information (if it defines
54 ``INCOMING_RETURN_ADDR_RTX`` and ``OBJECT_FORMAT_ELF``),
55 GCC will provide a default definition of 1.
56
57 .. function:: enum unwind_info_type TARGET_EXCEPT_UNWIND_INFO (struct gcc_options *opts)
58
59 This hook defines the mechanism that will be used for exception handling
60 by the target. If the target has ABI specified unwind tables, the hook
61 should return ``UI_TARGET``. If the target is to use the
62 ``setjmp`` / ``longjmp`` -based exception handling scheme, the hook
63 should return ``UI_SJLJ``. If the target supports DWARF 2 frame unwind
64 information, the hook should return ``UI_DWARF2``.
65
66 A target may, if exceptions are disabled, choose to return ``UI_NONE``.
67 This may end up simplifying other parts of target-specific code. The
68 default implementation of this hook never returns ``UI_NONE``.
69
70 Note that the value returned by this hook should be constant. It should
71 not depend on anything except the command-line switches described by
72 :samp:`{opts}`. In particular, the
73 setting ``UI_SJLJ`` must be fixed at compiler start-up as C pre-processor
74 macros and builtin functions related to exception handling are set up
75 depending on this setting.
76
77 The default implementation of the hook first honors the
78 :option:`--enable-sjlj-exceptions` configure option, then
79 ``DWARF2_UNWIND_INFO``, and finally defaults to ``UI_SJLJ``. If
80 ``DWARF2_UNWIND_INFO`` depends on command-line options, the target
81 must define this hook so that :samp:`{opts}` is used correctly.
82
83 .. c:var:: bool TARGET_UNWIND_TABLES_DEFAULT
84
85 This variable should be set to ``true`` if the target ABI requires unwinding
86 tables even when exceptions are not used. It must not be modified by
87 command-line option processing.
88
89 .. c:macro:: DONT_USE_BUILTIN_SETJMP
90
91 Define this macro to 1 if the ``setjmp`` / ``longjmp`` -based scheme
92 should use the ``setjmp`` / ``longjmp`` functions from the C library
93 instead of the ``__builtin_setjmp`` / ``__builtin_longjmp`` machinery.
94
95 .. c:macro:: JMP_BUF_SIZE
96
97 This macro has no effect unless ``DONT_USE_BUILTIN_SETJMP`` is also
98 defined. Define this macro if the default size of ``jmp_buf`` buffer
99 for the ``setjmp`` / ``longjmp`` -based exception handling mechanism
100 is not large enough, or if it is much too large.
101 The default size is ``FIRST_PSEUDO_REGISTER * sizeof(void *)``.
102
103 .. c:macro:: DWARF_CIE_DATA_ALIGNMENT
104
105 This macro need only be defined if the target might save registers in the
106 function prologue at an offset to the stack pointer that is not aligned to
107 ``UNITS_PER_WORD``. The definition should be the negative minimum
108 alignment if ``STACK_GROWS_DOWNWARD`` is true, and the positive
109 minimum alignment otherwise. See :ref:`dwarf`. Only applicable if
110 the target supports DWARF 2 frame unwind information.
111
112 .. include:: ../tm.rst.in
113 :start-after: [TARGET_TERMINATE_DW2_EH_FRAME_INFO]
114 :end-before: [TARGET_TERMINATE_DW2_EH_FRAME_INFO]
115
116
117 .. include:: ../tm.rst.in
118 :start-after: [TARGET_DWARF_REGISTER_SPAN]
119 :end-before: [TARGET_DWARF_REGISTER_SPAN]
120
121
122 .. include:: ../tm.rst.in
123 :start-after: [TARGET_DWARF_FRAME_REG_MODE]
124 :end-before: [TARGET_DWARF_FRAME_REG_MODE]
125
126
127 .. include:: ../tm.rst.in
128 :start-after: [TARGET_INIT_DWARF_REG_SIZES_EXTRA]
129 :end-before: [TARGET_INIT_DWARF_REG_SIZES_EXTRA]
130
131
132 .. include:: ../tm.rst.in
133 :start-after: [TARGET_ASM_TTYPE]
134 :end-before: [TARGET_ASM_TTYPE]
135
136
137 .. include:: ../tm.rst.in
138 :start-after: [TARGET_ARM_EABI_UNWINDER]
139 :end-before: [TARGET_ARM_EABI_UNWINDER]