Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* ldlang.h - linker command language support |
250d07de | 2 | Copyright (C) 1991-2021 Free Software Foundation, Inc. |
5cc18311 | 3 | |
f96b4a7b | 4 | This file is part of the GNU Binutils. |
5cc18311 | 5 | |
f96b4a7b | 6 | This program is free software; you can redistribute it and/or modify |
252b5132 | 7 | it under the terms of the GNU General Public License as published by |
f96b4a7b NC |
8 | the Free Software Foundation; either version 3 of the License, or |
9 | (at your option) any later version. | |
5cc18311 | 10 | |
f96b4a7b | 11 | This program is distributed in the hope that it will be useful, |
252b5132 RH |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
5cc18311 | 15 | |
252b5132 | 16 | You should have received a copy of the GNU General Public License |
f96b4a7b NC |
17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
19 | MA 02110-1301, USA. */ | |
252b5132 RH |
20 | |
21 | #ifndef LDLANG_H | |
22 | #define LDLANG_H | |
23 | ||
a747ee4d NC |
24 | #define DEFAULT_MEMORY_REGION "*default*" |
25 | ||
3edf7b9f DR |
26 | #define SECTION_NAME_MAP_LENGTH (16) |
27 | ||
6bdafbeb NC |
28 | typedef enum |
29 | { | |
252b5132 RH |
30 | lang_input_file_is_l_enum, |
31 | lang_input_file_is_symbols_only_enum, | |
32 | lang_input_file_is_marker_enum, | |
33 | lang_input_file_is_fake_enum, | |
34 | lang_input_file_is_search_file_enum, | |
35 | lang_input_file_is_file_enum | |
36 | } lang_input_file_enum_type; | |
37 | ||
6bdafbeb NC |
38 | struct _fill_type |
39 | { | |
2c382fb6 AM |
40 | size_t size; |
41 | unsigned char data[1]; | |
42 | }; | |
89cdebba | 43 | |
6bdafbeb NC |
44 | typedef struct statement_list |
45 | { | |
4a93e180 NC |
46 | union lang_statement_union * head; |
47 | union lang_statement_union ** tail; | |
252b5132 RH |
48 | } lang_statement_list_type; |
49 | ||
4a93e180 NC |
50 | typedef struct memory_region_name_struct |
51 | { | |
52 | const char * name; | |
53 | struct memory_region_name_struct * next; | |
54 | } lang_memory_region_name; | |
55 | ||
6bdafbeb NC |
56 | typedef struct memory_region_struct |
57 | { | |
4a93e180 | 58 | lang_memory_region_name name_list; |
252b5132 | 59 | struct memory_region_struct *next; |
cc9ad334 | 60 | union etree_union *origin_exp; |
252b5132 RH |
61 | bfd_vma origin; |
62 | bfd_size_type length; | |
cc9ad334 | 63 | union etree_union *length_exp; |
252b5132 | 64 | bfd_vma current; |
66e28d60 | 65 | union lang_statement_union *last_os; |
252b5132 RH |
66 | flagword flags; |
67 | flagword not_flags; | |
b34976b6 | 68 | bfd_boolean had_full_message; |
89cdebba KH |
69 | } lang_memory_region_type; |
70 | ||
1e9cc1c2 NC |
71 | enum statement_enum |
72 | { | |
1e9cc1c2 | 73 | lang_address_statement_enum, |
dc02848a | 74 | lang_assignment_statement_enum, |
1e9cc1c2 | 75 | lang_data_statement_enum, |
dc02848a | 76 | lang_fill_statement_enum, |
1e9cc1c2 | 77 | lang_group_statement_enum, |
dc02848a AM |
78 | lang_input_section_enum, |
79 | lang_input_statement_enum, | |
1e9cc1c2 | 80 | lang_insert_statement_enum, |
dc02848a AM |
81 | lang_output_section_statement_enum, |
82 | lang_output_statement_enum, | |
83 | lang_padding_statement_enum, | |
84 | lang_reloc_statement_enum, | |
85 | lang_target_statement_enum, | |
86 | lang_wild_statement_enum, | |
87 | lang_constructors_statement_enum, | |
88 | lang_object_symbols_statement_enum | |
1e9cc1c2 NC |
89 | }; |
90 | ||
6bdafbeb NC |
91 | typedef struct lang_statement_header_struct |
92 | { | |
e368bf56 | 93 | /* Next pointer for statement_list statement list. */ |
89cdebba | 94 | union lang_statement_union *next; |
1e9cc1c2 | 95 | enum statement_enum type; |
252b5132 RH |
96 | } lang_statement_header_type; |
97 | ||
6bdafbeb NC |
98 | typedef struct |
99 | { | |
252b5132 RH |
100 | lang_statement_header_type header; |
101 | union etree_union *exp; | |
102 | } lang_assignment_statement_type; | |
103 | ||
6bdafbeb NC |
104 | typedef struct lang_target_statement_struct |
105 | { | |
252b5132 RH |
106 | lang_statement_header_type header; |
107 | const char *target; | |
108 | } lang_target_statement_type; | |
109 | ||
6bdafbeb NC |
110 | typedef struct lang_output_statement_struct |
111 | { | |
252b5132 RH |
112 | lang_statement_header_type header; |
113 | const char *name; | |
114 | } lang_output_statement_type; | |
115 | ||
116 | /* Section types specified in a linker script. */ | |
117 | ||
6bdafbeb NC |
118 | enum section_type |
119 | { | |
252b5132 | 120 | normal_section, |
7b243801 | 121 | first_overlay_section, |
152d792f | 122 | overlay_section, |
252b5132 | 123 | noload_section, |
02a38f92 | 124 | noalloc_section |
252b5132 RH |
125 | }; |
126 | ||
6bdafbeb NC |
127 | /* This structure holds a list of program headers describing |
128 | segments in which this section should be placed. */ | |
252b5132 | 129 | |
6bdafbeb NC |
130 | typedef struct lang_output_section_phdr_list |
131 | { | |
252b5132 RH |
132 | struct lang_output_section_phdr_list *next; |
133 | const char *name; | |
b34976b6 | 134 | bfd_boolean used; |
6bdafbeb | 135 | } lang_output_section_phdr_list; |
252b5132 | 136 | |
6bdafbeb NC |
137 | typedef struct lang_output_section_statement_struct |
138 | { | |
252b5132 | 139 | lang_statement_header_type header; |
252b5132 | 140 | lang_statement_list_type children; |
afd7a018 | 141 | struct lang_output_section_statement_struct *next; |
218868ba | 142 | struct lang_output_section_statement_struct *prev; |
252b5132 | 143 | const char *name; |
252b5132 | 144 | asection *bfd_section; |
6bdafbeb NC |
145 | lang_memory_region_type *region; |
146 | lang_memory_region_type *lma_region; | |
2c382fb6 | 147 | fill_type *fill; |
7fabd029 | 148 | union etree_union *addr_tree; |
252b5132 | 149 | union etree_union *load_base; |
3d9c8f6b AM |
150 | union etree_union *section_alignment; |
151 | union etree_union *subsection_alignment; | |
252b5132 | 152 | |
9f88b410 RS |
153 | /* If non-null, an expression to evaluate after setting the section's |
154 | size. The expression is evaluated inside REGION (above) with '.' | |
155 | set to the end of the section. Used in the last overlay section | |
156 | to move '.' past all the overlaid sections. */ | |
157 | union etree_union *update_dot_tree; | |
158 | ||
6bdafbeb | 159 | lang_output_section_phdr_list *phdrs; |
7fabd029 AM |
160 | |
161 | unsigned int block_value; | |
7fabd029 AM |
162 | int constraint; |
163 | flagword flags; | |
164 | enum section_type sectype; | |
cde9e0be AM |
165 | unsigned int processed_vma : 1; |
166 | unsigned int processed_lma : 1; | |
7fabd029 | 167 | unsigned int all_input_readonly : 1; |
49c13adb | 168 | /* If this section should be ignored. */ |
e4492aa0 | 169 | unsigned int ignored : 1; |
6d8bf25d | 170 | /* If this section should update "dot". Prevents section being ignored. */ |
e4492aa0 | 171 | unsigned int update_dot : 1; |
d2667025 AM |
172 | /* If this section is after assignment to _end. */ |
173 | unsigned int after_end : 1; | |
1eec346e NC |
174 | /* If this section uses the alignment of its input sections. */ |
175 | unsigned int align_lma_with_input : 1; | |
de34d428 AM |
176 | /* If script has duplicate output section statements of the same name |
177 | create duplicate output sections. */ | |
178 | unsigned int dup_output : 1; | |
252b5132 RH |
179 | } lang_output_section_statement_type; |
180 | ||
6bdafbeb NC |
181 | typedef struct |
182 | { | |
252b5132 | 183 | lang_statement_header_type header; |
2c382fb6 | 184 | fill_type *fill; |
252b5132 RH |
185 | int size; |
186 | asection *output_section; | |
187 | } lang_fill_statement_type; | |
188 | ||
6bdafbeb NC |
189 | typedef struct |
190 | { | |
252b5132 RH |
191 | lang_statement_header_type header; |
192 | unsigned int type; | |
89cdebba | 193 | union etree_union *exp; |
252b5132 RH |
194 | bfd_vma value; |
195 | asection *output_section; | |
7fabd029 | 196 | bfd_vma output_offset; |
252b5132 RH |
197 | } lang_data_statement_type; |
198 | ||
199 | /* Generate a reloc in the output file. */ | |
200 | ||
6bdafbeb NC |
201 | typedef struct |
202 | { | |
252b5132 RH |
203 | lang_statement_header_type header; |
204 | ||
205 | /* Reloc to generate. */ | |
206 | bfd_reloc_code_real_type reloc; | |
207 | ||
208 | /* Reloc howto structure. */ | |
209 | reloc_howto_type *howto; | |
210 | ||
6bdafbeb NC |
211 | /* Section to generate reloc against. |
212 | Exactly one of section and name must be NULL. */ | |
252b5132 RH |
213 | asection *section; |
214 | ||
6bdafbeb NC |
215 | /* Name of symbol to generate reloc against. |
216 | Exactly one of section and name must be NULL. */ | |
252b5132 RH |
217 | const char *name; |
218 | ||
219 | /* Expression for addend. */ | |
220 | union etree_union *addend_exp; | |
221 | ||
222 | /* Resolved addend. */ | |
223 | bfd_vma addend_value; | |
224 | ||
225 | /* Output section where reloc should be performed. */ | |
226 | asection *output_section; | |
227 | ||
7fabd029 AM |
228 | /* Offset within output section. */ |
229 | bfd_vma output_offset; | |
252b5132 RH |
230 | } lang_reloc_statement_type; |
231 | ||
66be1055 | 232 | struct lang_input_statement_flags |
6bdafbeb | 233 | { |
66be1055 | 234 | /* 1 means this file was specified in a -l option. */ |
b7f95647 | 235 | unsigned int maybe_archive : 1; |
5cc18311 | 236 | |
d4ae5fb0 AM |
237 | /* 1 means this file was specified in a -l:namespec option. */ |
238 | unsigned int full_name_provided : 1; | |
239 | ||
252b5132 | 240 | /* 1 means search a set of directories for this file. */ |
66be1055 | 241 | unsigned int search_dirs : 1; |
5cc18311 | 242 | |
f4a23d42 | 243 | /* 1 means this was found when processing a script in the sysroot. */ |
409d7240 | 244 | unsigned int sysrooted : 1; |
e3f2db7f | 245 | |
252b5132 RH |
246 | /* 1 means this is base file of incremental load. |
247 | Do not load this file's text or data. | |
5cc18311 | 248 | Also default text_start to after this file's bss. */ |
66be1055 | 249 | unsigned int just_syms : 1; |
252b5132 RH |
250 | |
251 | /* Whether to search for this entry as a dynamic archive. */ | |
409d7240 | 252 | unsigned int dynamic : 1; |
252b5132 | 253 | |
15fc2e13 AM |
254 | /* Set if a DT_NEEDED tag should be added not just for the dynamic library |
255 | explicitly given by this entry but also for any dynamic libraries in | |
256 | this entry's needed list. */ | |
ddbb8a31 | 257 | unsigned int add_DT_NEEDED_for_dynamic : 1; |
e56f61be | 258 | |
15fc2e13 AM |
259 | /* Set if this entry should cause a DT_NEEDED tag only when some |
260 | regular file references its symbols (ie. --as-needed is in effect). */ | |
ddbb8a31 | 261 | unsigned int add_DT_NEEDED_for_regular : 1; |
4a43e768 | 262 | |
252b5132 | 263 | /* Whether to include the entire contents of an archive. */ |
409d7240 | 264 | unsigned int whole_archive : 1; |
252b5132 | 265 | |
c4b78195 | 266 | /* Set when bfd opening is successful. */ |
409d7240 | 267 | unsigned int loaded : 1; |
5cc18311 | 268 | |
409d7240 | 269 | unsigned int real : 1; |
c4b78195 NC |
270 | |
271 | /* Set if the file does not exist. */ | |
272 | unsigned int missing_file : 1; | |
5d3236ee | 273 | |
e77620a5 AM |
274 | /* Set if reloading an archive or --as-needed lib. */ |
275 | unsigned int reload : 1; | |
276 | ||
0381901e | 277 | #if BFD_SUPPORTS_PLUGINS |
5d3236ee DK |
278 | /* Set if the file was claimed by a plugin. */ |
279 | unsigned int claimed : 1; | |
280 | ||
8543fde5 DK |
281 | /* Set if the file was claimed from an archive. */ |
282 | unsigned int claim_archive : 1; | |
ce875075 AM |
283 | |
284 | /* Set if added by the lto plugin add_input_file callback. */ | |
285 | unsigned int lto_output : 1; | |
0381901e | 286 | #endif /* BFD_SUPPORTS_PLUGINS */ |
26278bb8 UD |
287 | |
288 | /* Head of list of pushed flags. */ | |
289 | struct lang_input_statement_flags *pushed; | |
66be1055 AM |
290 | }; |
291 | ||
292 | typedef struct lang_input_statement_struct | |
293 | { | |
294 | lang_statement_header_type header; | |
295 | /* Name of this file. */ | |
296 | const char *filename; | |
297 | /* Name to use for the symbol giving address of text start. | |
298 | Usually the same as filename, but for a file spec'd with | |
299 | -l this is the -l switch itself rather than the filename. */ | |
300 | const char *local_sym_name; | |
16171946 FS |
301 | /* Extra search path. Used to find a file relative to the |
302 | directory of the current linker script. */ | |
303 | const char *extra_search_path; | |
66be1055 AM |
304 | |
305 | bfd *the_bfd; | |
306 | ||
1ff6de03 NA |
307 | ctf_archive_t *the_ctf; |
308 | ||
66be1055 AM |
309 | struct flag_info *section_flag_list; |
310 | ||
e368bf56 | 311 | /* Next pointer for file_chain statement list. */ |
36983a93 | 312 | struct lang_input_statement_struct *next; |
66be1055 | 313 | |
e368bf56 | 314 | /* Next pointer for input_file_chain statement list. */ |
36983a93 | 315 | struct lang_input_statement_struct *next_real_file; |
66be1055 AM |
316 | |
317 | const char *target; | |
8543fde5 | 318 | |
66be1055 | 319 | struct lang_input_statement_flags flags; |
252b5132 RH |
320 | } lang_input_statement_type; |
321 | ||
6bdafbeb NC |
322 | typedef struct |
323 | { | |
252b5132 RH |
324 | lang_statement_header_type header; |
325 | asection *section; | |
5cc18311 | 326 | } lang_input_section_type; |
252b5132 | 327 | |
7dd9c6eb AM |
328 | struct map_symbol_def { |
329 | struct bfd_link_hash_entry *entry; | |
330 | struct map_symbol_def *next; | |
331 | }; | |
332 | ||
6fcc66ab AM |
333 | /* For input sections, when writing a map file: head / tail of a linked |
334 | list of hash table entries for symbols defined in this section. */ | |
335 | typedef struct input_section_userdata_struct | |
336 | { | |
337 | struct map_symbol_def *map_symbol_def_head; | |
338 | struct map_symbol_def **map_symbol_def_tail; | |
339 | unsigned long map_symbol_def_count; | |
340 | } input_section_userdata_type; | |
341 | ||
00f93c44 AM |
342 | static inline bfd_boolean |
343 | bfd_input_just_syms (const bfd *abfd) | |
344 | { | |
345 | lang_input_statement_type *is = bfd_usrdata (abfd); | |
346 | return is != NULL && is->flags.just_syms; | |
347 | } | |
6fcc66ab | 348 | |
72223188 JJ |
349 | typedef struct lang_wild_statement_struct lang_wild_statement_type; |
350 | ||
351 | typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, | |
b9c361e0 JL |
352 | asection *, struct flag_info *, |
353 | lang_input_statement_type *, void *); | |
72223188 JJ |
354 | |
355 | typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *, | |
356 | lang_input_statement_type *, | |
357 | callback_t callback, | |
358 | void *data); | |
359 | ||
390fbbf1 AM |
360 | typedef bfd_boolean (*lang_match_sec_type_func) (bfd *, const asection *, |
361 | bfd *, const asection *); | |
362 | ||
e6f2cbf5 L |
363 | /* Binary search tree structure to efficiently sort sections by |
364 | name. */ | |
365 | typedef struct lang_section_bst | |
366 | { | |
367 | asection *section; | |
368 | struct lang_section_bst *left; | |
369 | struct lang_section_bst *right; | |
370 | } lang_section_bst_type; | |
371 | ||
72223188 | 372 | struct lang_wild_statement_struct |
6bdafbeb | 373 | { |
252b5132 | 374 | lang_statement_header_type header; |
252b5132 | 375 | const char *filename; |
b34976b6 | 376 | bfd_boolean filenames_sorted; |
b6bf44ba | 377 | struct wildcard_list *section_list; |
b34976b6 | 378 | bfd_boolean keep_sections; |
252b5132 | 379 | lang_statement_list_type children; |
8f1732fc | 380 | struct name_list *exclude_name_list; |
72223188 JJ |
381 | |
382 | walk_wild_section_handler_t walk_wild_section_handler; | |
383 | struct wildcard_list *handler_data[4]; | |
e6f2cbf5 | 384 | lang_section_bst_type *tree; |
ae17ab41 | 385 | struct flag_info *section_flag_list; |
72223188 | 386 | }; |
252b5132 | 387 | |
6bdafbeb NC |
388 | typedef struct lang_address_statement_struct |
389 | { | |
252b5132 | 390 | lang_statement_header_type header; |
89cdebba KH |
391 | const char *section_name; |
392 | union etree_union *address; | |
ba916c8a | 393 | const segment_type *segment; |
252b5132 RH |
394 | } lang_address_statement_type; |
395 | ||
6bdafbeb NC |
396 | typedef struct |
397 | { | |
252b5132 RH |
398 | lang_statement_header_type header; |
399 | bfd_vma output_offset; | |
1a69ff95 | 400 | bfd_size_type size; |
252b5132 | 401 | asection *output_section; |
2c382fb6 | 402 | fill_type *fill; |
252b5132 RH |
403 | } lang_padding_statement_type; |
404 | ||
405 | /* A group statement collects a set of libraries together. The | |
406 | libraries are searched multiple times, until no new undefined | |
407 | symbols are found. The effect is to search a group of libraries as | |
408 | though they were a single library. */ | |
409 | ||
6bdafbeb NC |
410 | typedef struct |
411 | { | |
252b5132 RH |
412 | lang_statement_header_type header; |
413 | lang_statement_list_type children; | |
414 | } lang_group_statement_type; | |
415 | ||
53d25da6 AM |
416 | typedef struct |
417 | { | |
418 | lang_statement_header_type header; | |
419 | const char *where; | |
420 | bfd_boolean is_before; | |
421 | } lang_insert_statement_type; | |
422 | ||
6bdafbeb NC |
423 | typedef union lang_statement_union |
424 | { | |
252b5132 | 425 | lang_statement_header_type header; |
252b5132 | 426 | lang_address_statement_type address_statement; |
252b5132 | 427 | lang_assignment_statement_type assignment_statement; |
dc02848a | 428 | lang_data_statement_type data_statement; |
252b5132 | 429 | lang_fill_statement_type fill_statement; |
252b5132 | 430 | lang_group_statement_type group_statement; |
dc02848a AM |
431 | lang_input_section_type input_section; |
432 | lang_input_statement_type input_statement; | |
53d25da6 | 433 | lang_insert_statement_type insert_statement; |
dc02848a AM |
434 | lang_output_section_statement_type output_section_statement; |
435 | lang_output_statement_type output_statement; | |
436 | lang_padding_statement_type padding_statement; | |
437 | lang_reloc_statement_type reloc_statement; | |
438 | lang_target_statement_type target_statement; | |
439 | lang_wild_statement_type wild_statement; | |
252b5132 RH |
440 | } lang_statement_union_type; |
441 | ||
442 | /* This structure holds information about a program header, from the | |
443 | PHDRS command in the linker script. */ | |
444 | ||
6bdafbeb NC |
445 | struct lang_phdr |
446 | { | |
252b5132 RH |
447 | struct lang_phdr *next; |
448 | const char *name; | |
449 | unsigned long type; | |
b34976b6 AM |
450 | bfd_boolean filehdr; |
451 | bfd_boolean phdrs; | |
252b5132 RH |
452 | etree_type *at; |
453 | etree_type *flags; | |
454 | }; | |
455 | ||
456 | /* This structure is used to hold a list of sections which may not | |
457 | cross reference each other. */ | |
458 | ||
6bdafbeb NC |
459 | typedef struct lang_nocrossref |
460 | { | |
252b5132 RH |
461 | struct lang_nocrossref *next; |
462 | const char *name; | |
6bdafbeb | 463 | } lang_nocrossref_type; |
252b5132 RH |
464 | |
465 | /* The list of nocrossref lists. */ | |
466 | ||
6bdafbeb NC |
467 | struct lang_nocrossrefs |
468 | { | |
252b5132 | 469 | struct lang_nocrossrefs *next; |
6bdafbeb | 470 | lang_nocrossref_type *list; |
cdf96953 | 471 | bfd_boolean onlyfirst; |
252b5132 RH |
472 | }; |
473 | ||
577a0623 AM |
474 | /* This structure is used to hold a list of input section names which |
475 | will not match an output section in the linker script. */ | |
476 | ||
6bdafbeb NC |
477 | struct unique_sections |
478 | { | |
577a0623 AM |
479 | struct unique_sections *next; |
480 | const char *name; | |
481 | }; | |
482 | ||
afd7a018 AM |
483 | /* Used by place_orphan to keep track of orphan sections and statements. */ |
484 | ||
4a93e180 NC |
485 | struct orphan_save |
486 | { | |
afd7a018 AM |
487 | const char *name; |
488 | flagword flags; | |
489 | lang_output_section_statement_type *os; | |
490 | asection **section; | |
491 | lang_statement_union_type **stmt; | |
492 | lang_output_section_statement_type **os_tail; | |
493 | }; | |
494 | ||
16e4ecc0 AM |
495 | struct asneeded_minfo |
496 | { | |
497 | struct asneeded_minfo *next; | |
498 | const char *soname; | |
499 | bfd *ref; | |
500 | const char *name; | |
501 | }; | |
502 | ||
66be1055 AM |
503 | extern struct lang_phdr *lang_phdr_list; |
504 | extern struct lang_nocrossrefs *nocrossref_list; | |
8be573a7 | 505 | extern const char *output_target; |
252b5132 | 506 | extern lang_output_section_statement_type *abs_output_section; |
5c1e6d53 | 507 | extern lang_statement_list_type lang_os_list; |
66be1055 | 508 | extern struct lang_input_statement_flags input_flags; |
b34976b6 | 509 | extern bfd_boolean lang_has_input_file; |
252b5132 | 510 | extern lang_statement_list_type *stat_ptr; |
b34976b6 | 511 | extern bfd_boolean delete_output_file_on_failure; |
252b5132 | 512 | |
e3e942e9 | 513 | extern struct bfd_sym_chain entry_symbol; |
1e281515 | 514 | extern const char *entry_section; |
b34976b6 | 515 | extern bfd_boolean entry_from_cmdline; |
b71e2778 | 516 | extern lang_statement_list_type file_chain; |
dc27aea4 | 517 | extern lang_statement_list_type input_file_chain; |
252b5132 | 518 | |
37a141bf FS |
519 | extern struct bfd_elf_dynamic_list **current_dynamic_list_p; |
520 | ||
420e579c | 521 | extern int lang_statement_iteration; |
16e4ecc0 | 522 | extern struct asneeded_minfo **asneeded_list_tail; |
420e579c | 523 | |
eae25ec5 HPN |
524 | extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *); |
525 | ||
f53154de | 526 | extern void lang_init |
1579bae1 | 527 | (void); |
750877ba L |
528 | extern void lang_finish |
529 | (void); | |
4a93e180 NC |
530 | extern lang_memory_region_type * lang_memory_region_lookup |
531 | (const char * const, bfd_boolean); | |
532 | extern void lang_memory_region_alias | |
533 | (const char *, const char *); | |
f53154de | 534 | extern void lang_map |
1579bae1 | 535 | (void); |
f53154de | 536 | extern void lang_set_flags |
1579bae1 | 537 | (lang_memory_region_type *, const char *, int); |
f53154de | 538 | extern void lang_add_output |
1579bae1 | 539 | (const char *, int from_script); |
aea4bd9d | 540 | extern lang_output_section_statement_type *lang_enter_output_section_statement |
1eec346e NC |
541 | (const char *, etree_type *, enum section_type, etree_type *, etree_type *, |
542 | etree_type *, int, int); | |
f53154de | 543 | extern void lang_final |
1579bae1 | 544 | (void); |
eaeb0a9d AM |
545 | extern void lang_relax_sections |
546 | (bfd_boolean); | |
f53154de | 547 | extern void lang_process |
1579bae1 | 548 | (void); |
f53154de | 549 | extern void lang_section_start |
ba916c8a | 550 | (const char *, union etree_union *, const segment_type *); |
f53154de | 551 | extern void lang_add_entry |
1579bae1 | 552 | (const char *, bfd_boolean); |
a359509e ZW |
553 | extern void lang_default_entry |
554 | (const char *); | |
f53154de | 555 | extern void lang_add_target |
1579bae1 | 556 | (const char *); |
252b5132 | 557 | extern void lang_add_wild |
1579bae1 | 558 | (struct wildcard_spec *, struct wildcard_list *, bfd_boolean); |
f53154de | 559 | extern void lang_add_map |
1579bae1 | 560 | (const char *); |
f53154de | 561 | extern void lang_add_fill |
1579bae1 AM |
562 | (fill_type *); |
563 | extern lang_assignment_statement_type *lang_add_assignment | |
564 | (union etree_union *); | |
f53154de | 565 | extern void lang_add_attribute |
1579bae1 | 566 | (enum statement_enum); |
f53154de | 567 | extern void lang_startup |
1579bae1 | 568 | (const char *); |
f53154de | 569 | extern void lang_float |
1579bae1 | 570 | (bfd_boolean); |
252b5132 | 571 | extern void lang_leave_output_section_statement |
6bdafbeb | 572 | (fill_type *, const char *, lang_output_section_phdr_list *, |
1579bae1 | 573 | const char *); |
252b5132 | 574 | extern void lang_for_each_input_file |
1579bae1 | 575 | (void (*dothis) (lang_input_statement_type *)); |
252b5132 | 576 | extern void lang_for_each_file |
1579bae1 | 577 | (void (*dothis) (lang_input_statement_type *)); |
f53154de | 578 | extern void lang_reset_memory_regions |
1579bae1 | 579 | (void); |
f2241121 | 580 | extern void lang_do_assignments |
2f65ac72 | 581 | (lang_phase_type); |
d2667025 AM |
582 | extern asection *section_for_dot |
583 | (void); | |
252b5132 | 584 | |
f53154de AM |
585 | #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \ |
586 | lang_input_statement_type *statement; \ | |
b72636de | 587 | for (statement = (lang_input_statement_type *) file_chain.head; \ |
1fa4ec6a | 588 | statement != NULL; \ |
36983a93 | 589 | statement = statement->next) |
5cc18311 | 590 | |
66c103b7 | 591 | #define lang_output_section_find(NAME) \ |
21401fc7 | 592 | lang_output_section_statement_lookup (NAME, 0, 0) |
66c103b7 | 593 | |
f53154de | 594 | extern void lang_process |
1579bae1 | 595 | (void); |
f53154de | 596 | extern void ldlang_add_file |
1579bae1 | 597 | (lang_input_statement_type *); |
afd7a018 | 598 | extern lang_output_section_statement_type *lang_output_section_find_by_flags |
93638471 | 599 | (const asection *, flagword, lang_output_section_statement_type **, |
390fbbf1 | 600 | lang_match_sec_type_func); |
afd7a018 | 601 | extern lang_output_section_statement_type *lang_insert_orphan |
8a99a385 | 602 | (asection *, const char *, int, lang_output_section_statement_type *, |
7b986e99 | 603 | struct orphan_save *, etree_type *, lang_statement_list_type *); |
252b5132 | 604 | extern lang_input_statement_type *lang_add_input_file |
1579bae1 | 605 | (const char *, lang_input_file_enum_type, const char *); |
f53154de | 606 | extern void lang_add_keepsyms_file |
1579bae1 | 607 | (const char *); |
24ef1aa7 GM |
608 | extern lang_output_section_statement_type *lang_output_section_get |
609 | (const asection *); | |
66c103b7 | 610 | extern lang_output_section_statement_type *lang_output_section_statement_lookup |
21401fc7 | 611 | (const char *, int, int); |
d127ecce AM |
612 | extern lang_output_section_statement_type *next_matching_output_section_statement |
613 | (lang_output_section_statement_type *, int); | |
f53154de | 614 | extern void ldlang_add_undef |
24898b70 | 615 | (const char *const, bfd_boolean); |
0a618243 AB |
616 | extern void ldlang_add_require_defined |
617 | (const char *const); | |
f53154de | 618 | extern void lang_add_output_format |
1579bae1 | 619 | (const char *, const char *, const char *, int); |
f53154de | 620 | extern void lang_list_init |
1579bae1 | 621 | (lang_statement_list_type *); |
bde18da4 AM |
622 | extern void push_stat_ptr |
623 | (lang_statement_list_type *); | |
624 | extern void pop_stat_ptr | |
625 | (void); | |
f53154de | 626 | extern void lang_add_data |
1579bae1 | 627 | (int type, union etree_union *); |
252b5132 | 628 | extern void lang_add_reloc |
1579bae1 AM |
629 | (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *, |
630 | union etree_union *); | |
252b5132 | 631 | extern void lang_for_each_statement |
1579bae1 | 632 | (void (*) (lang_statement_union_type *)); |
8658f989 AM |
633 | extern void lang_for_each_statement_worker |
634 | (void (*) (lang_statement_union_type *), lang_statement_union_type *); | |
1579bae1 AM |
635 | extern void *stat_alloc |
636 | (size_t); | |
8423293d AM |
637 | extern void strip_excluded_output_sections |
638 | (void); | |
18cd5bce AM |
639 | extern void lang_clear_os_map |
640 | (void); | |
f53154de | 641 | extern void dprint_statement |
1579bae1 | 642 | (lang_statement_union_type *, int); |
e9ee469a AM |
643 | extern void lang_size_sections |
644 | (bfd_boolean *, bfd_boolean); | |
645 | extern void one_lang_size_sections_pass | |
646 | (bfd_boolean *, bfd_boolean); | |
53d25da6 AM |
647 | extern void lang_add_insert |
648 | (const char *, int); | |
f53154de | 649 | extern void lang_enter_group |
1579bae1 | 650 | (void); |
f53154de | 651 | extern void lang_leave_group |
1579bae1 | 652 | (void); |
39dcfe18 | 653 | extern void lang_add_section |
1579bae1 | 654 | (lang_statement_list_type *, asection *, |
b9c361e0 | 655 | struct flag_info *, lang_output_section_statement_type *); |
252b5132 | 656 | extern void lang_new_phdr |
1579bae1 AM |
657 | (const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *, |
658 | etree_type *); | |
f53154de | 659 | extern void lang_add_nocrossref |
6bdafbeb | 660 | (lang_nocrossref_type *); |
cdf96953 MF |
661 | extern void lang_add_nocrossref_to |
662 | (lang_nocrossref_type *); | |
f53154de | 663 | extern void lang_enter_overlay |
7e7d5768 | 664 | (etree_type *, etree_type *); |
f53154de | 665 | extern void lang_enter_overlay_section |
1579bae1 | 666 | (const char *); |
252b5132 | 667 | extern void lang_leave_overlay_section |
6bdafbeb | 668 | (fill_type *, lang_output_section_phdr_list *); |
252b5132 | 669 | extern void lang_leave_overlay |
1579bae1 | 670 | (etree_type *, int, fill_type *, const char *, |
6bdafbeb | 671 | lang_output_section_phdr_list *, const char *); |
252b5132 | 672 | |
313e35ee | 673 | extern struct bfd_elf_version_expr *lang_new_vers_pattern |
86043bbb | 674 | (struct bfd_elf_version_expr *, const char *, const char *, bfd_boolean); |
252b5132 | 675 | extern struct bfd_elf_version_tree *lang_new_vers_node |
1579bae1 | 676 | (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *); |
252b5132 | 677 | extern struct bfd_elf_version_deps *lang_add_vers_depend |
1579bae1 | 678 | (struct bfd_elf_version_deps *, const char *); |
252b5132 | 679 | extern void lang_register_vers_node |
1579bae1 | 680 | (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *); |
37a141bf FS |
681 | extern void lang_append_dynamic_list (struct bfd_elf_dynamic_list **, |
682 | struct bfd_elf_version_expr *); | |
55255dae | 683 | extern void lang_append_dynamic_list_cpp_typeinfo (void); |
40b36307 | 684 | extern void lang_append_dynamic_list_cpp_new (void); |
f53154de | 685 | extern void lang_add_unique |
1579bae1 | 686 | (const char *); |
f53154de | 687 | extern const char *lang_get_output_target |
1579bae1 | 688 | (void); |
b58f81ae | 689 | extern void add_excluded_libs (const char *); |
e9f53129 AM |
690 | extern bfd_boolean load_symbols |
691 | (lang_input_statement_type *, lang_statement_list_type *); | |
b58f81ae | 692 | |
1ff6de03 NA |
693 | struct elf_sym_strtab; |
694 | struct elf_strtab_hash; | |
3d16b64e NA |
695 | extern void ldlang_ctf_acquire_strings |
696 | (struct elf_strtab_hash *); | |
697 | extern void ldlang_ctf_new_dynsym | |
698 | (int symidx, struct elf_internal_sym *); | |
1ff6de03 NA |
699 | extern void ldlang_write_ctf_late |
700 | (void); | |
2889e75b NC |
701 | extern bfd_boolean |
702 | ldlang_override_segment_assignment | |
703 | (struct bfd_link_info *, bfd *, asection *, asection *, bfd_boolean); | |
704 | ||
01554a74 AM |
705 | extern void |
706 | lang_ld_feature (char *); | |
707 | ||
3604cb1f TG |
708 | extern void |
709 | lang_print_memory_usage (void); | |
710 | ||
4153b6db NC |
711 | extern void |
712 | lang_add_gc_name (const char *); | |
713 | ||
3edf7b9f DR |
714 | extern bfd_boolean |
715 | print_one_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr); | |
716 | ||
252b5132 | 717 | #endif |