]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/darwin-sections.def
Update copyright years.
[thirdparty/gcc.git] / gcc / config / darwin-sections.def
CommitLineData
a945c346 1/* Copyright (C) 2005-2024 Free Software Foundation, Inc.
ad41bd84
JM
2
3This file is part of GCC.
4
5GCC is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free
7Software Foundation; either version 3, or (at your option) any later
8version.
9
10GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11WARRANTY; without even the implied warranty of MERCHANTABILITY or
12FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13for more details.
14
15You should have received a copy of the GNU General Public License
16along with GCC; see the file COPYING3. If not see
17<http://www.gnu.org/licenses/>. */
18
46a99b06 19/* Since Darwin's ld will not allow zero-sized objects, and gcc wants them,
e53b6e56 20 we emit one byte (in darwin.cc) when such an object is encountered.
46a99b06
IS
21
22 This messes up section anchoring because the emitted byte is not counted
23 outside the port. To cope with this, we set aside sections for zero-sized
24 objects and disallow those sections from participating in section anchors
25 ("zobj_" sections, below).
26
27 Items that might be coalesced by the linker are prevented from participating,
e53b6e56 28 (and those in mergeable sections are disallowed in varasm.cc). */
46a99b06 29
e53b6e56 30/* The .text section is generated in varasm.cc */
46a99b06 31DEF_SECTION (text_coal_section, SECTION_CODE|SECTION_NO_ANCHOR,
d6b5193b 32 ".section __TEXT,__textcoal_nt,coalesced,pure_instructions", 0)
46a99b06 33
794fa8a6
IS
34/* We define a picbase thunks section separately, so that we can override the
35 def to be '.text' for versions of ld64 that handle coalescing. */
36DEF_SECTION (picbase_thunk_section, SECTION_CODE|SECTION_NO_ANCHOR,
37 ".section __TEXT,__textcoal_nt,coalesced,pure_instructions", 0)
38
1f81953b
IS
39DEF_SECTION (text_hot_section, SECTION_CODE,
40 ".section __TEXT,__text_hot,regular,pure_instructions", 0)
41DEF_SECTION (text_cold_section, SECTION_CODE,
42 ".section __TEXT,__text_cold,regular,pure_instructions", 0)
43DEF_SECTION (text_startup_section, SECTION_CODE,
44 ".section __TEXT,__text_startup,regular,pure_instructions", 0)
45DEF_SECTION (text_exit_section, SECTION_CODE,
46 ".section __TEXT,__text_exit,regular,pure_instructions", 0)
47
48DEF_SECTION (text_hot_coal_section, SECTION_CODE,
49 ".section __TEXT,__text_hot_coal,coalesced,pure_instructions", 0)
50DEF_SECTION (text_cold_coal_section, SECTION_CODE,
51 ".section __TEXT,__text_cold_coal,coalesced,pure_instructions", 0)
52DEF_SECTION (text_startup_coal_section, SECTION_CODE,
53 ".section __TEXT,__text_stt_coal,coalesced,pure_instructions", 0)
54DEF_SECTION (text_exit_coal_section, SECTION_CODE,
55 ".section __TEXT,__text_exit_coal,coalesced,pure_instructions", 0)
56
46a99b06 57/* const */
d6b5193b 58DEF_SECTION (const_section, 0, ".const", 0)
46a99b06 59DEF_SECTION (const_coal_section, SECTION_NO_ANCHOR,
d6b5193b 60 ".section __TEXT,__const_coal,coalesced", 0)
46a99b06
IS
61/* Place to put zero-sized to avoid issues with section anchors. */
62DEF_SECTION (zobj_const_section, SECTION_NO_ANCHOR,
63 ".section\t__DATA,__zobj_const", 0)
64
e53b6e56 65/* Write-able data. '.data' handled in varasm.cc */
46a99b06
IS
66DEF_SECTION (static_data_section, SECTION_WRITE, ".static_data", 0)
67DEF_SECTION (data_coal_section, SECTION_WRITE|SECTION_NO_ANCHOR,
68 ".section __DATA,__datacoal_nt,coalesced", 0)
69/* Place to put zero-sized to avoid issues with section anchors. */
70DEF_SECTION (zobj_data_section, SECTION_WRITE|SECTION_NO_ANCHOR,
71 ".section\t__DATA,__zobj_data", 0)
72
73/* BSS - .lcomm / .zerofill __DATA,__bss sections cannot be switched to
74 explicitly (will create an assembler error). */
75DEF_SECTION (zobj_bss_section, SECTION_WRITE|SECTION_BSS|SECTION_NO_ANCHOR,
76 ".section\t__DATA,__zobj_bss", 0)
77
78/* const data */
d6b5193b 79DEF_SECTION (const_data_section, 0, ".const_data", 0)
46a99b06 80DEF_SECTION (const_data_coal_section, SECTION_NO_ANCHOR,
d6b5193b 81 ".section __DATA,__const_coal,coalesced", 0)
46a99b06
IS
82/* Place to put zero-sized to avoid issues with section anchors. */
83DEF_SECTION (zobj_const_data_section, SECTION_NO_ANCHOR,
0a5a95f2 84 ".section\t__DATA,__zobj_cnst_data", 0)
46a99b06
IS
85
86/* Strings and other literals. */
59ff4a1c 87DEF_SECTION (cstring_section, SECTION_MERGE | SECTION_STRINGS, ".cstring", 0)
ab0ff804
AP
88DEF_SECTION (literal4_section, SECTION_MERGE, ".literal4", 0)
89DEF_SECTION (literal8_section, SECTION_MERGE, ".literal8", 0)
f7288899 90DEF_SECTION (literal16_section, SECTION_MERGE, ".literal16", 0)
46a99b06
IS
91/* Unlike constant NSStrings, constant CFStrings do not live in the
92 __OBJC segment since they may also occur in pure C or C++ programs. */
93DEF_SECTION (cfstring_constant_object_section, 0,
94 ".section __DATA, __cfstring", 0)
95
96/* Module init, term, constructors & destructors. */
d6b5193b
RS
97DEF_SECTION (mod_init_section, 0, ".mod_init_func", 0)
98DEF_SECTION (mod_term_section, 0, ".mod_term_func", 0)
46a99b06 99DEF_SECTION (constructor_section, 0, ".constructor", 0)
d6b5193b 100DEF_SECTION (destructor_section, 0, ".destructor", 0)
68dc3e94
IS
101DEF_SECTION (static_init_section, SECTION_CODE,
102 ".section\t__TEXT,__StaticInit,regular,pure_instructions", 0)
46a99b06 103
d764a8e6 104/* Objective-C ABI=0 (Original version) sections. */
d6b5193b
RS
105DEF_SECTION (objc_class_section, 0, ".objc_class", 1)
106DEF_SECTION (objc_meta_class_section, 0, ".objc_meta_class", 1)
107DEF_SECTION (objc_category_section, 0, ".objc_category", 1)
108DEF_SECTION (objc_class_vars_section, 0, ".objc_class_vars", 1)
109DEF_SECTION (objc_instance_vars_section, 0, ".objc_instance_vars", 1)
110DEF_SECTION (objc_cls_meth_section, 0, ".objc_cls_meth", 1)
111DEF_SECTION (objc_inst_meth_section, 0, ".objc_inst_meth", 1)
112DEF_SECTION (objc_cat_cls_meth_section, 0, ".objc_cat_cls_meth", 1)
113DEF_SECTION (objc_cat_inst_meth_section, 0, ".objc_cat_inst_meth", 1)
ab0ff804 114DEF_SECTION (objc_selector_refs_section, SECTION_MERGE, ".objc_message_refs", 1)
d6b5193b
RS
115DEF_SECTION (objc_selector_fixup_section, 0,
116 ".section __OBJC, __sel_fixup, regular, no_dead_strip", 1)
117DEF_SECTION (objc_symbols_section, 0, ".objc_symbols", 1)
118DEF_SECTION (objc_module_info_section, 0, ".objc_module_info", 1)
119DEF_SECTION (objc_protocol_section, 0, ".objc_protocol", 1)
120DEF_SECTION (objc_string_object_section, 0, ".objc_string_object", 1)
121DEF_SECTION (objc_constant_string_object_section, 0,
d764a8e6 122 ".section __OBJC, __cstring_object, regular, no_dead_strip", 0)
d6b5193b
RS
123
124/* Fix-and-Continue image marker. */
125DEF_SECTION (objc_image_info_section, 0,
126 ".section __OBJC, __image_info, regular, no_dead_strip", 1)
127DEF_SECTION (objc_class_names_section, 0, ".objc_class_names", 1)
128DEF_SECTION (objc_meth_var_names_section, 0, ".objc_meth_var_names", 1)
129DEF_SECTION (objc_meth_var_types_section, 0, ".objc_meth_var_types", 1)
ab0ff804 130DEF_SECTION (objc_cls_refs_section, SECTION_MERGE, ".objc_cls_refs", 1)
46a99b06
IS
131
132/* Stubs and symbol indirection sections. */
fee3eacd 133/* lazy symbol pointers. */
46a99b06
IS
134DEF_SECTION (machopic_lazy_symbol_ptr_section, SECTION_NO_ANCHOR,
135 ".lazy_symbol_pointer", 0)
136DEF_SECTION (machopic_lazy_symbol_ptr2_section, SECTION_NO_ANCHOR,
fee3eacd 137 ".section __DATA, __la_sym_ptr2,lazy_symbol_pointers", 0)
46a99b06 138DEF_SECTION (machopic_lazy_symbol_ptr3_section, SECTION_NO_ANCHOR,
fee3eacd
IS
139 ".section __DATA, __la_sym_ptr3,lazy_symbol_pointers", 0)
140/* non-lazy symbol pointers. */
46a99b06 141DEF_SECTION (machopic_nl_symbol_ptr_section, SECTION_NO_ANCHOR,
fee3eacd
IS
142 MACHOPIC_NL_SYMBOL_PTR_SECTION, 0)
143/* Symbol stubs. */
46a99b06
IS
144DEF_SECTION (machopic_symbol_stub_section, SECTION_NO_ANCHOR,
145 ".symbol_stub", 0)
146DEF_SECTION (machopic_symbol_stub1_section, SECTION_NO_ANCHOR,
d6b5193b
RS
147 ".section __TEXT,__symbol_stub1,symbol_stubs,"
148 "pure_instructions,16", 0)
fee3eacd 149/* PIC symbol stubs. */
46a99b06
IS
150DEF_SECTION (machopic_picsymbol_stub_section, SECTION_NO_ANCHOR,
151 ".picsymbol_stub", 0)
152DEF_SECTION (machopic_picsymbol_stub1_section, SECTION_NO_ANCHOR,
d6b5193b
RS
153 ".section __TEXT,__picsymbolstub1,symbol_stubs,"
154 "pure_instructions,32", 0)
46a99b06 155DEF_SECTION (machopic_picsymbol_stub2_section, SECTION_NO_ANCHOR,
fee3eacd 156 ".section __TEXT,__picsymbolstub2,symbol_stubs,pure_instructions,25", 0)
46a99b06 157DEF_SECTION (machopic_picsymbol_stub3_section, SECTION_NO_ANCHOR,
fee3eacd 158 ".section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5", 0)
46a99b06 159
fee3eacd 160/* Exception-related. */
46a99b06 161DEF_SECTION (darwin_exception_section, SECTION_NO_ANCHOR,
0fe7962a 162 ".section __TEXT,__gcc_except_tab", 0)
46a99b06 163DEF_SECTION (darwin_eh_frame_section, SECTION_NO_ANCHOR,
d6b5193b
RS
164 ".section " EH_FRAME_SECTION_NAME ",__eh_frame"
165 EH_FRAME_SECTION_ATTR, 0)
d764a8e6
IS
166
167/* Sections for ObjC ABI=1 (ObjC 'V1' extensions) */
168DEF_SECTION (objc1_class_ext_section, 0,
169 ".section __OBJC, __class_ext, regular, no_dead_strip", 1)
170DEF_SECTION (objc1_prop_list_section, 0,
171 ".section __OBJC, __property, regular, no_dead_strip", 1)
172DEF_SECTION (objc1_protocol_ext_section, 0,
173 ".section __OBJC, __protocol_ext, regular, no_dead_strip", 1)
174
175/* Sections for ObjC ABI=2 (m64). */
176DEF_SECTION (objc2_message_refs_section, 0,
177 ".section __DATA, __objc_msgrefs, regular, no_dead_strip", 1)
178DEF_SECTION (objc2_classdefs_section, 0, ".section __DATA, __objc_data", 1)
179DEF_SECTION (objc2_metadata_section, 0, ".section __DATA, __objc_const", 1)
180
181DEF_SECTION (objc2_classrefs_section, 0,
182 ".section __DATA, __objc_classrefs, regular, no_dead_strip", 1)
183DEF_SECTION (objc2_classlist_section, 0,
184 ".section __DATA, __objc_classlist, regular, no_dead_strip", 1)
185DEF_SECTION (objc2_categorylist_section, 0,
186 ".section __DATA, __objc_catlist, regular, no_dead_strip", 1)
187DEF_SECTION (objc2_selector_refs_section, 0,
188 ".section __DATA, __objc_selrefs, literal_pointers, no_dead_strip", 1)
189DEF_SECTION (objc2_nonlazy_class_section, 0,
190 ".section __DATA, __objc_nlclslist, regular, no_dead_strip", 1)
191DEF_SECTION (objc2_nonlazy_category_section, 0,
192 ".section __DATA, __objc_nlcatlist, regular, no_dead_strip", 1)
193DEF_SECTION (objc2_protocollist_section, 0,
194 ".section __DATA, __objc_protolist, regular, no_dead_strip", 1)
195DEF_SECTION (objc2_protocolrefs_section, 0,
196 ".section __DATA, __objc_protorefs, regular, no_dead_strip", 1)
197DEF_SECTION (objc2_super_classrefs_section, 0,
198 ".section __DATA, __objc_superrefs, regular, no_dead_strip", 1)
199DEF_SECTION (objc2_image_info_section, 0,
200 ".section __DATA, __objc_imageinfo, regular, no_dead_strip", 1)
201DEF_SECTION (objc2_constant_string_object_section, 0,
202 ".section __DATA, __objc_stringobj, regular, no_dead_strip", 1)
a788c455
IS
203
204/* Additions for compatibility with later runtime conventions especially for
205 sections containing strings. */
ecd616f6
IS
206DEF_SECTION (objc2_data_section, 0, ".section __DATA, __data", 1)
207
208DEF_SECTION (objc2_ivar_section, 0, ".section __DATA, __objc_ivar", 1)
209
a788c455
IS
210DEF_SECTION (objc2_class_names_section, 0,
211 ".section __TEXT, __objc_classname, cstring_literals", 1)
212
213DEF_SECTION (objc2_method_names_section, 0,
214 ".section __TEXT, __objc_methname, cstring_literals", 1)
215
216DEF_SECTION (objc2_method_types_section, 0,
217 ".section __TEXT, __objc_methtype, cstring_literals", 1)