]>
Commit | Line | Data |
---|---|---|
1 | /* ldlang.h - linker command language support | |
2 | Copyright (C) 1991-2025 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of the GNU Binutils. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
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. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
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. */ | |
20 | ||
21 | #ifndef LDLANG_H | |
22 | #define LDLANG_H | |
23 | ||
24 | #define DEFAULT_MEMORY_REGION "*default*" | |
25 | ||
26 | #define SECTION_NAME_MAP_LENGTH (16) | |
27 | ||
28 | typedef enum | |
29 | { | |
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 | ||
38 | struct _fill_type | |
39 | { | |
40 | size_t size; | |
41 | unsigned char data[1]; | |
42 | }; | |
43 | ||
44 | typedef struct statement_list | |
45 | { | |
46 | union lang_statement_union * head; | |
47 | union lang_statement_union ** tail; | |
48 | } lang_statement_list_type; | |
49 | ||
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 | ||
56 | typedef struct memory_region_struct | |
57 | { | |
58 | lang_memory_region_name name_list; | |
59 | struct memory_region_struct *next; | |
60 | union etree_union *origin_exp; | |
61 | bfd_vma origin; | |
62 | bfd_size_type length; | |
63 | union etree_union *length_exp; | |
64 | bfd_vma current; | |
65 | union lang_statement_union *last_os; | |
66 | flagword flags; | |
67 | flagword not_flags; | |
68 | bool had_full_message; | |
69 | } lang_memory_region_type; | |
70 | ||
71 | enum statement_enum | |
72 | { | |
73 | lang_address_statement_enum, | |
74 | lang_assignment_statement_enum, | |
75 | lang_data_statement_enum, | |
76 | lang_fill_statement_enum, | |
77 | lang_group_statement_enum, | |
78 | lang_input_section_enum, | |
79 | lang_input_matcher_enum, | |
80 | lang_input_statement_enum, | |
81 | lang_insert_statement_enum, | |
82 | lang_output_section_statement_enum, | |
83 | lang_output_statement_enum, | |
84 | lang_padding_statement_enum, | |
85 | lang_reloc_statement_enum, | |
86 | lang_target_statement_enum, | |
87 | lang_wild_statement_enum, | |
88 | lang_constructors_statement_enum, | |
89 | lang_object_symbols_statement_enum | |
90 | }; | |
91 | ||
92 | typedef struct lang_statement_header_struct | |
93 | { | |
94 | /* Next pointer for statement_list statement list. */ | |
95 | union lang_statement_union *next; | |
96 | enum statement_enum type; | |
97 | } lang_statement_header_type; | |
98 | ||
99 | typedef struct | |
100 | { | |
101 | lang_statement_header_type header; | |
102 | union etree_union *exp; | |
103 | } lang_assignment_statement_type; | |
104 | ||
105 | typedef struct lang_target_statement_struct | |
106 | { | |
107 | lang_statement_header_type header; | |
108 | const char *target; | |
109 | } lang_target_statement_type; | |
110 | ||
111 | typedef struct lang_output_statement_struct | |
112 | { | |
113 | lang_statement_header_type header; | |
114 | const char *name; | |
115 | } lang_output_statement_type; | |
116 | ||
117 | /* Section types specified in a linker script. */ | |
118 | ||
119 | enum section_type | |
120 | { | |
121 | normal_section, | |
122 | first_overlay_section, | |
123 | overlay_section, | |
124 | noload_section, | |
125 | noalloc_section, | |
126 | type_section, | |
127 | readonly_section, | |
128 | typed_readonly_section | |
129 | }; | |
130 | ||
131 | /* This structure holds a list of program headers describing | |
132 | segments in which this section should be placed. */ | |
133 | ||
134 | typedef struct lang_output_section_phdr_list | |
135 | { | |
136 | struct lang_output_section_phdr_list *next; | |
137 | const char *name; | |
138 | bool used; | |
139 | } lang_output_section_phdr_list; | |
140 | ||
141 | typedef struct lang_output_section_statement_struct | |
142 | { | |
143 | lang_statement_header_type header; | |
144 | /* Input sections to be mapped to this output section. */ | |
145 | lang_statement_list_type children; | |
146 | /* Input sections to be mapped to the start of this output section. | |
147 | These sections are provided by the --section-ordering file, if used. */ | |
148 | lang_statement_list_type sort_children; | |
149 | ||
150 | struct lang_output_section_statement_struct *next; | |
151 | struct lang_output_section_statement_struct *prev; | |
152 | const char *name; | |
153 | asection *bfd_section; | |
154 | lang_memory_region_type *region; | |
155 | lang_memory_region_type *lma_region; | |
156 | fill_type *fill; | |
157 | union etree_union *addr_tree; | |
158 | union etree_union *load_base; | |
159 | union etree_union *section_alignment; | |
160 | union etree_union *subsection_alignment; | |
161 | ||
162 | /* If non-null, an expression to evaluate after setting the section's | |
163 | size. The expression is evaluated inside REGION (above) with '.' | |
164 | set to the end of the section. Used in the last overlay section | |
165 | to move '.' past all the overlaid sections. */ | |
166 | union etree_union *update_dot_tree; | |
167 | ||
168 | lang_output_section_phdr_list *phdrs; | |
169 | ||
170 | /* Used by ELF SHF_LINK_ORDER sorting. */ | |
171 | void *data; | |
172 | ||
173 | unsigned int block_value; | |
174 | int constraint; | |
175 | flagword flags; | |
176 | enum section_type sectype; | |
177 | etree_type *sectype_value; | |
178 | unsigned int processed_vma : 1; | |
179 | unsigned int processed_lma : 1; | |
180 | unsigned int all_input_readonly : 1; | |
181 | /* If this section should be ignored. */ | |
182 | unsigned int ignored : 1; | |
183 | /* If this section should update "dot". Prevents section being ignored. */ | |
184 | unsigned int update_dot : 1; | |
185 | /* If this section is after assignment to _end. */ | |
186 | unsigned int after_end : 1; | |
187 | /* If this section uses the alignment of its input sections. */ | |
188 | unsigned int align_lma_with_input : 1; | |
189 | /* If script has duplicate output section statements of the same name | |
190 | create duplicate output sections. */ | |
191 | unsigned int dup_output : 1; | |
192 | } lang_output_section_statement_type; | |
193 | ||
194 | typedef struct | |
195 | { | |
196 | lang_statement_header_type header; | |
197 | fill_type *fill; | |
198 | int size; | |
199 | asection *output_section; | |
200 | } lang_fill_statement_type; | |
201 | ||
202 | typedef struct | |
203 | { | |
204 | lang_statement_header_type header; | |
205 | unsigned int type; | |
206 | union etree_union *exp; | |
207 | bfd_vma value; | |
208 | asection *output_section; | |
209 | bfd_vma output_offset; | |
210 | } lang_data_statement_type; | |
211 | ||
212 | /* Generate a reloc in the output file. */ | |
213 | ||
214 | typedef struct | |
215 | { | |
216 | lang_statement_header_type header; | |
217 | ||
218 | /* Reloc to generate. */ | |
219 | bfd_reloc_code_real_type reloc; | |
220 | ||
221 | /* Reloc howto structure. */ | |
222 | reloc_howto_type *howto; | |
223 | ||
224 | /* Section to generate reloc against. | |
225 | Exactly one of section and name must be NULL. */ | |
226 | asection *section; | |
227 | ||
228 | /* Name of symbol to generate reloc against. | |
229 | Exactly one of section and name must be NULL. */ | |
230 | const char *name; | |
231 | ||
232 | /* Expression for addend. */ | |
233 | union etree_union *addend_exp; | |
234 | ||
235 | /* Resolved addend. */ | |
236 | bfd_vma addend_value; | |
237 | ||
238 | /* Output section where reloc should be performed. */ | |
239 | asection *output_section; | |
240 | ||
241 | /* Offset within output section. */ | |
242 | bfd_vma output_offset; | |
243 | } lang_reloc_statement_type; | |
244 | ||
245 | struct lang_input_statement_flags | |
246 | { | |
247 | /* 1 means this file was specified in a -l option. */ | |
248 | unsigned int maybe_archive : 1; | |
249 | ||
250 | /* 1 means this file was specified in a -l:namespec option. */ | |
251 | unsigned int full_name_provided : 1; | |
252 | ||
253 | /* 1 means search a set of directories for this file. */ | |
254 | unsigned int search_dirs : 1; | |
255 | ||
256 | /* 1 means this was found when processing a script in the sysroot. */ | |
257 | unsigned int sysrooted : 1; | |
258 | ||
259 | /* 1 means this is base file of incremental load. | |
260 | Do not load this file's text or data. | |
261 | Also default text_start to after this file's bss. */ | |
262 | unsigned int just_syms : 1; | |
263 | ||
264 | /* Whether to search for this entry as a dynamic archive. */ | |
265 | unsigned int dynamic : 1; | |
266 | ||
267 | /* Set if a DT_NEEDED tag should be added not just for the dynamic library | |
268 | explicitly given by this entry but also for any dynamic libraries in | |
269 | this entry's needed list. */ | |
270 | unsigned int add_DT_NEEDED_for_dynamic : 1; | |
271 | ||
272 | /* Set if this entry should cause a DT_NEEDED tag only when some | |
273 | regular file references its symbols (ie. --as-needed is in effect). */ | |
274 | unsigned int add_DT_NEEDED_for_regular : 1; | |
275 | ||
276 | /* Whether to include the entire contents of an archive. */ | |
277 | unsigned int whole_archive : 1; | |
278 | ||
279 | /* Set when bfd opening is successful. */ | |
280 | unsigned int loaded : 1; | |
281 | ||
282 | unsigned int real : 1; | |
283 | ||
284 | /* Set if the file does not exist. */ | |
285 | unsigned int missing_file : 1; | |
286 | ||
287 | /* Set if reloading an archive or --as-needed lib. */ | |
288 | unsigned int reload : 1; | |
289 | ||
290 | #if BFD_SUPPORTS_PLUGINS | |
291 | /* Set if the file was claimed by a plugin. */ | |
292 | unsigned int claimed : 1; | |
293 | ||
294 | /* Set if the file was claimed from an archive. */ | |
295 | unsigned int claim_archive : 1; | |
296 | ||
297 | /* Set if added by the lto plugin add_input_file callback. */ | |
298 | unsigned int lto_output : 1; | |
299 | #endif /* BFD_SUPPORTS_PLUGINS */ | |
300 | ||
301 | /* Head of list of pushed flags. */ | |
302 | struct lang_input_statement_flags *pushed; | |
303 | }; | |
304 | ||
305 | typedef struct lang_input_statement_struct | |
306 | { | |
307 | lang_statement_header_type header; | |
308 | /* Name of this file. */ | |
309 | const char *filename; | |
310 | /* Name to use for the symbol giving address of text start. | |
311 | Usually the same as filename, but for a file spec'd with | |
312 | -l this is the -l switch itself rather than the filename. */ | |
313 | const char *local_sym_name; | |
314 | /* Name to use when sorting. */ | |
315 | const char *sort_key; | |
316 | /* Extra search path. Used to find a file relative to the | |
317 | directory of the current linker script. */ | |
318 | const char *extra_search_path; | |
319 | ||
320 | bfd *the_bfd; | |
321 | ||
322 | ctf_archive_t *the_ctf; | |
323 | ||
324 | struct flag_info *section_flag_list; | |
325 | ||
326 | /* Next pointer for file_chain statement list. */ | |
327 | struct lang_input_statement_struct *next; | |
328 | ||
329 | /* Next pointer for input_file_chain statement list. */ | |
330 | struct lang_input_statement_struct *next_real_file; | |
331 | ||
332 | const char *target; | |
333 | ||
334 | struct lang_input_statement_flags flags; | |
335 | } lang_input_statement_type; | |
336 | ||
337 | typedef struct | |
338 | { | |
339 | lang_statement_header_type header; | |
340 | asection *section; | |
341 | void *pattern; | |
342 | } lang_input_section_type; | |
343 | ||
344 | typedef struct | |
345 | { | |
346 | lang_statement_header_type header; | |
347 | asection *section; | |
348 | void *pattern; | |
349 | lang_input_statement_type *input_stmt; | |
350 | } lang_input_matcher_type; | |
351 | ||
352 | struct map_symbol_def { | |
353 | struct bfd_link_hash_entry *entry; | |
354 | struct map_symbol_def *next; | |
355 | }; | |
356 | ||
357 | /* For input sections, when writing a map file: head / tail of a linked | |
358 | list of hash table entries for symbols defined in this section. */ | |
359 | typedef struct input_section_userdata_struct | |
360 | { | |
361 | struct map_symbol_def *map_symbol_def_head; | |
362 | struct map_symbol_def **map_symbol_def_tail; | |
363 | unsigned long map_symbol_def_count; | |
364 | } input_section_userdata_type; | |
365 | ||
366 | static inline bool | |
367 | bfd_input_just_syms (const bfd *abfd) | |
368 | { | |
369 | lang_input_statement_type *is = bfd_usrdata (abfd); | |
370 | return is != NULL && is->flags.just_syms; | |
371 | } | |
372 | ||
373 | typedef struct lang_wild_statement_struct lang_wild_statement_type; | |
374 | ||
375 | typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, | |
376 | asection *, lang_input_statement_type *, void *); | |
377 | ||
378 | typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *, | |
379 | lang_input_statement_type *, | |
380 | callback_t callback, | |
381 | void *data); | |
382 | ||
383 | typedef bool (*lang_match_sec_type_func) (bfd *, const asection *, | |
384 | bfd *, const asection *); | |
385 | ||
386 | /* Binary search tree structure to efficiently sort sections by | |
387 | name. */ | |
388 | typedef struct lang_section_bst | |
389 | { | |
390 | asection *section; | |
391 | void *pattern; | |
392 | struct lang_section_bst *left; | |
393 | struct lang_section_bst *right; | |
394 | } lang_section_bst_type; | |
395 | ||
396 | struct lang_wild_statement_struct | |
397 | { | |
398 | lang_statement_header_type header; | |
399 | lang_statement_list_type children; | |
400 | lang_statement_list_type matching_sections; | |
401 | lang_section_bst_type * tree; | |
402 | lang_section_bst_type ** rightmost; | |
403 | struct wildcard_list * section_list; | |
404 | struct name_list * exclude_name_list; | |
405 | struct flag_info * section_flag_list; | |
406 | const char * filename; | |
407 | bool filenames_sorted; | |
408 | bool filenames_reversed; | |
409 | bool any_specs_sorted; | |
410 | bool keep_sections; | |
411 | }; | |
412 | ||
413 | typedef struct lang_address_statement_struct | |
414 | { | |
415 | lang_statement_header_type header; | |
416 | const char *section_name; | |
417 | union etree_union *address; | |
418 | const segment_type *segment; | |
419 | } lang_address_statement_type; | |
420 | ||
421 | typedef struct | |
422 | { | |
423 | lang_statement_header_type header; | |
424 | bfd_vma output_offset; | |
425 | bfd_size_type size; | |
426 | asection *output_section; | |
427 | fill_type *fill; | |
428 | } lang_padding_statement_type; | |
429 | ||
430 | /* A group statement collects a set of libraries together. The | |
431 | libraries are searched multiple times, until no new undefined | |
432 | symbols are found. The effect is to search a group of libraries as | |
433 | though they were a single library. */ | |
434 | ||
435 | typedef struct | |
436 | { | |
437 | lang_statement_header_type header; | |
438 | lang_statement_list_type children; | |
439 | } lang_group_statement_type; | |
440 | ||
441 | typedef struct | |
442 | { | |
443 | lang_statement_header_type header; | |
444 | const char *where; | |
445 | bool is_before; | |
446 | } lang_insert_statement_type; | |
447 | ||
448 | typedef union lang_statement_union | |
449 | { | |
450 | lang_statement_header_type header; | |
451 | lang_address_statement_type address_statement; | |
452 | lang_assignment_statement_type assignment_statement; | |
453 | lang_data_statement_type data_statement; | |
454 | lang_fill_statement_type fill_statement; | |
455 | lang_group_statement_type group_statement; | |
456 | lang_input_section_type input_section; | |
457 | lang_input_matcher_type input_matcher; | |
458 | lang_input_statement_type input_statement; | |
459 | lang_insert_statement_type insert_statement; | |
460 | lang_output_section_statement_type output_section_statement; | |
461 | lang_output_statement_type output_statement; | |
462 | lang_padding_statement_type padding_statement; | |
463 | lang_reloc_statement_type reloc_statement; | |
464 | lang_target_statement_type target_statement; | |
465 | lang_wild_statement_type wild_statement; | |
466 | } lang_statement_union_type; | |
467 | ||
468 | /* This structure holds information about a program header, from the | |
469 | PHDRS command in the linker script. */ | |
470 | ||
471 | struct lang_phdr | |
472 | { | |
473 | struct lang_phdr *next; | |
474 | const char *name; | |
475 | unsigned long type; | |
476 | bool filehdr; | |
477 | bool phdrs; | |
478 | etree_type *at; | |
479 | etree_type *flags; | |
480 | }; | |
481 | ||
482 | /* This structure is used to hold a list of sections which may not | |
483 | cross reference each other. */ | |
484 | ||
485 | typedef struct lang_nocrossref | |
486 | { | |
487 | struct lang_nocrossref *next; | |
488 | const char *name; | |
489 | } lang_nocrossref_type; | |
490 | ||
491 | /* The list of nocrossref lists. */ | |
492 | ||
493 | struct lang_nocrossrefs | |
494 | { | |
495 | struct lang_nocrossrefs *next; | |
496 | lang_nocrossref_type *list; | |
497 | bool onlyfirst; | |
498 | }; | |
499 | ||
500 | /* This structure is used to hold a list of input section names which | |
501 | will not match an output section in the linker script. */ | |
502 | ||
503 | struct unique_sections | |
504 | { | |
505 | struct unique_sections *next; | |
506 | const char *name; | |
507 | }; | |
508 | ||
509 | /* Used by place_orphan to keep track of orphan sections and statements. */ | |
510 | ||
511 | struct orphan_save | |
512 | { | |
513 | const char *name; | |
514 | flagword flags; | |
515 | lang_output_section_statement_type *os; | |
516 | asection **section; | |
517 | lang_statement_union_type **stmt; | |
518 | lang_output_section_statement_type **os_tail; | |
519 | }; | |
520 | ||
521 | struct asneeded_minfo | |
522 | { | |
523 | struct asneeded_minfo *next; | |
524 | const char *soname; | |
525 | bfd *ref; | |
526 | const char *name; | |
527 | }; | |
528 | ||
529 | extern struct lang_phdr *lang_phdr_list; | |
530 | extern struct lang_nocrossrefs *nocrossref_list; | |
531 | extern const char *output_target; | |
532 | extern lang_output_section_statement_type *abs_output_section; | |
533 | extern lang_statement_list_type lang_os_list; | |
534 | extern struct lang_input_statement_flags input_flags; | |
535 | extern bool lang_has_input_file; | |
536 | extern lang_statement_list_type statement_list; | |
537 | extern lang_statement_list_type *stat_ptr; | |
538 | extern bool delete_output_file_on_failure; | |
539 | extern bool enable_linker_version; | |
540 | ||
541 | extern struct bfd_sym_chain entry_symbol; | |
542 | extern const char *entry_section; | |
543 | extern bool entry_from_cmdline; | |
544 | extern lang_statement_list_type file_chain; | |
545 | extern lang_statement_list_type input_file_chain; | |
546 | ||
547 | extern struct bfd_elf_dynamic_list **current_dynamic_list_p; | |
548 | ||
549 | extern int lang_statement_iteration; | |
550 | extern struct asneeded_minfo **asneeded_list_tail; | |
551 | ||
552 | extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *); | |
553 | ||
554 | extern void lang_init | |
555 | (bool); | |
556 | extern void lang_finish | |
557 | (void); | |
558 | extern lang_memory_region_type * lang_memory_region_lookup | |
559 | (const char * const, bool); | |
560 | extern void lang_memory_region_alias | |
561 | (const char *, const char *); | |
562 | extern void lang_map | |
563 | (void); | |
564 | extern void lang_set_flags | |
565 | (lang_memory_region_type *, const char *, int); | |
566 | extern void lang_add_output | |
567 | (const char *, int from_script); | |
568 | extern lang_output_section_statement_type *lang_enter_output_section_statement | |
569 | (const char *, etree_type *, enum section_type, etree_type *, etree_type *, | |
570 | etree_type *, etree_type *, int, int); | |
571 | extern void lang_final | |
572 | (void); | |
573 | extern void lang_relax_sections | |
574 | (bool); | |
575 | extern void lang_process | |
576 | (void); | |
577 | extern void lang_section_start | |
578 | (const char *, union etree_union *, const segment_type *); | |
579 | extern void lang_add_entry | |
580 | (const char *, bool); | |
581 | extern void lang_default_entry | |
582 | (const char *); | |
583 | extern void lang_add_target | |
584 | (const char *); | |
585 | extern void lang_add_wild | |
586 | (struct wildcard_spec *, struct wildcard_list *, bool); | |
587 | extern void lang_add_map | |
588 | (const char *); | |
589 | extern void lang_add_fill | |
590 | (fill_type *); | |
591 | extern lang_assignment_statement_type *lang_add_assignment | |
592 | (union etree_union *); | |
593 | extern void lang_add_attribute | |
594 | (enum statement_enum); | |
595 | extern void lang_startup | |
596 | (const char *); | |
597 | extern void lang_float | |
598 | (bool); | |
599 | extern void lang_leave_output_section_statement | |
600 | (fill_type *, const char *, lang_output_section_phdr_list *, | |
601 | const char *); | |
602 | extern void lang_for_each_input_file | |
603 | (void (*dothis) (lang_input_statement_type *)); | |
604 | extern void lang_for_each_file | |
605 | (void (*dothis) (lang_input_statement_type *)); | |
606 | extern void lang_reset_memory_regions | |
607 | (void); | |
608 | extern void lang_do_assignments | |
609 | (lang_phase_type); | |
610 | extern asection *section_for_dot | |
611 | (void); | |
612 | ||
613 | #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \ | |
614 | lang_input_statement_type *statement; \ | |
615 | for (statement = (lang_input_statement_type *) file_chain.head; \ | |
616 | statement != NULL; \ | |
617 | statement = statement->next) | |
618 | ||
619 | #define lang_output_section_find(NAME) \ | |
620 | lang_output_section_statement_lookup (NAME, 0, 0) | |
621 | ||
622 | extern void lang_process | |
623 | (void); | |
624 | extern void ldlang_add_file | |
625 | (lang_input_statement_type *); | |
626 | extern lang_output_section_statement_type *lang_output_section_find_by_flags | |
627 | (const asection *, flagword, lang_output_section_statement_type **, | |
628 | lang_match_sec_type_func); | |
629 | extern lang_output_section_statement_type *lang_insert_orphan | |
630 | (asection *, const char *, int, lang_output_section_statement_type *, | |
631 | struct orphan_save *, etree_type *, lang_statement_list_type *); | |
632 | extern lang_input_statement_type *lang_add_input_file | |
633 | (const char *, lang_input_file_enum_type, const char *); | |
634 | extern void lang_add_keepsyms_file | |
635 | (const char *); | |
636 | extern lang_output_section_statement_type *lang_output_section_get | |
637 | (const asection *); | |
638 | extern lang_output_section_statement_type *lang_output_section_statement_lookup | |
639 | (const char *, int, int); | |
640 | extern lang_output_section_statement_type *next_matching_output_section_statement | |
641 | (lang_output_section_statement_type *, int); | |
642 | extern void ldlang_add_undef | |
643 | (const char *const, bool); | |
644 | extern void ldlang_add_require_defined | |
645 | (const char *const); | |
646 | extern void lang_add_output_format | |
647 | (const char *, const char *, const char *, int); | |
648 | extern void lang_list_init | |
649 | (lang_statement_list_type *); | |
650 | extern void push_stat_ptr | |
651 | (lang_statement_list_type *); | |
652 | extern void pop_stat_ptr | |
653 | (void); | |
654 | extern void lang_add_data | |
655 | (int, union etree_union *); | |
656 | extern void lang_add_string | |
657 | (const char *); | |
658 | extern void lang_add_reloc | |
659 | (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *, | |
660 | union etree_union *); | |
661 | extern void lang_for_each_statement | |
662 | (void (*) (lang_statement_union_type *)); | |
663 | extern void lang_for_each_statement_worker | |
664 | (void (*) (lang_statement_union_type *), lang_statement_union_type *); | |
665 | extern void *stat_alloc | |
666 | (size_t); | |
667 | extern void stat_free | |
668 | (void *); | |
669 | extern void *stat_memdup | |
670 | (const void *, size_t, size_t); | |
671 | extern char *stat_strdup | |
672 | (const char *); | |
673 | extern char *stat_concat | |
674 | (const char *, ...); | |
675 | extern void strip_excluded_output_sections | |
676 | (void); | |
677 | extern void lang_clear_os_map | |
678 | (void); | |
679 | extern void dprint_statement | |
680 | (lang_statement_union_type *, int); | |
681 | extern void lang_size_sections | |
682 | (bool *, bool); | |
683 | extern void one_lang_size_sections_pass | |
684 | (bool *, bool); | |
685 | extern void lang_add_insert | |
686 | (const char *, int); | |
687 | extern void lang_enter_group | |
688 | (void); | |
689 | extern void lang_leave_group | |
690 | (void); | |
691 | extern void lang_add_section | |
692 | (lang_statement_list_type *, asection *, struct wildcard_list *, | |
693 | struct flag_info *, lang_output_section_statement_type *); | |
694 | extern void lang_new_phdr | |
695 | (const char *, etree_type *, bool, bool, etree_type *, | |
696 | etree_type *); | |
697 | extern void lang_add_nocrossref | |
698 | (lang_nocrossref_type *); | |
699 | extern void lang_add_nocrossref_to | |
700 | (lang_nocrossref_type *); | |
701 | extern void lang_enter_overlay | |
702 | (etree_type *, etree_type *); | |
703 | extern void lang_enter_overlay_section | |
704 | (const char *); | |
705 | extern void lang_leave_overlay_section | |
706 | (fill_type *, lang_output_section_phdr_list *); | |
707 | extern void lang_leave_overlay | |
708 | (etree_type *, int, fill_type *, const char *, | |
709 | lang_output_section_phdr_list *, const char *); | |
710 | ||
711 | extern struct bfd_elf_version_expr *lang_new_vers_pattern | |
712 | (struct bfd_elf_version_expr *, const char *, const char *, bool); | |
713 | extern struct bfd_elf_version_tree *lang_new_vers_node | |
714 | (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *); | |
715 | extern struct bfd_elf_version_deps *lang_add_vers_depend | |
716 | (struct bfd_elf_version_deps *, const char *); | |
717 | extern void lang_register_vers_node | |
718 | (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *); | |
719 | extern void lang_append_dynamic_list (struct bfd_elf_dynamic_list **, | |
720 | struct bfd_elf_version_expr *); | |
721 | extern void lang_append_dynamic_list_cpp_typeinfo (void); | |
722 | extern void lang_append_dynamic_list_cpp_new (void); | |
723 | extern void lang_add_unique | |
724 | (const char *); | |
725 | extern const char *lang_get_output_target | |
726 | (void); | |
727 | extern void add_excluded_libs (const char *); | |
728 | extern bool load_symbols | |
729 | (lang_input_statement_type *, lang_statement_list_type *); | |
730 | ||
731 | struct elf_sym_strtab; | |
732 | struct elf_strtab_hash; | |
733 | extern void ldlang_ctf_acquire_strings | |
734 | (struct elf_strtab_hash *); | |
735 | extern void ldlang_ctf_new_dynsym | |
736 | (int symidx, struct elf_internal_sym *); | |
737 | extern void ldlang_write_ctf_late | |
738 | (void); | |
739 | extern bool | |
740 | ldlang_override_segment_assignment | |
741 | (struct bfd_link_info *, bfd *, asection *, asection *, bool); | |
742 | ||
743 | extern void | |
744 | lang_ld_feature (char *); | |
745 | ||
746 | extern void | |
747 | lang_print_memory_usage (void); | |
748 | ||
749 | extern void | |
750 | lang_add_gc_name (const char *); | |
751 | ||
752 | extern bool | |
753 | print_one_symbol (struct bfd_link_hash_entry *, void *); | |
754 | ||
755 | extern void lang_add_version_string | |
756 | (void); | |
757 | ||
758 | typedef enum | |
759 | { | |
760 | cmdline_is_file_enum, | |
761 | cmdline_is_bfd_enum | |
762 | } cmdline_enum_type; | |
763 | ||
764 | typedef struct cmdline_header_struct | |
765 | { | |
766 | union cmdline_union *next; | |
767 | cmdline_enum_type type; | |
768 | } cmdline_header_type; | |
769 | ||
770 | typedef struct cmdline_file_struct | |
771 | { | |
772 | cmdline_header_type header; | |
773 | const char *filename; | |
774 | } cmdline_file_type; | |
775 | ||
776 | typedef struct cmdline_bfd_struct | |
777 | { | |
778 | cmdline_header_type header; | |
779 | bfd *abfd; | |
780 | } cmdline_bfd_type; | |
781 | ||
782 | typedef union cmdline_union | |
783 | { | |
784 | cmdline_header_type header; | |
785 | cmdline_file_type file; | |
786 | cmdline_bfd_type abfd; | |
787 | } cmdline_union_type; | |
788 | ||
789 | typedef struct cmdline_list | |
790 | { | |
791 | cmdline_union_type *head; | |
792 | cmdline_union_type **tail; | |
793 | } cmdline_list_type; | |
794 | ||
795 | extern void cmdline_emit_object_only_section (void); | |
796 | extern void cmdline_check_object_only_section (bfd *, bool); | |
797 | extern void cmdline_remove_object_only_files (void); | |
798 | ||
799 | #endif |