]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/ldlang.h
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / ld / ldlang.h
CommitLineData
252b5132 1/* ldlang.h - linker command language support
e8e7cf2a 2 Copyright (C) 1991-2025 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
28typedef 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
38struct _fill_type
39{
2c382fb6
AM
40 size_t size;
41 unsigned char data[1];
42};
89cdebba 43
6bdafbeb
NC
44typedef 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
50typedef 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
56typedef 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;
f38a2680 68 bool had_full_message;
89cdebba
KH
69} lang_memory_region_type;
70
1e9cc1c2
NC
71enum 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 78 lang_input_section_enum,
43ae96e9 79 lang_input_matcher_enum,
dc02848a 80 lang_input_statement_enum,
1e9cc1c2 81 lang_insert_statement_enum,
dc02848a
AM
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
1e9cc1c2
NC
90};
91
6bdafbeb
NC
92typedef struct lang_statement_header_struct
93{
e368bf56 94 /* Next pointer for statement_list statement list. */
89cdebba 95 union lang_statement_union *next;
1e9cc1c2 96 enum statement_enum type;
252b5132
RH
97} lang_statement_header_type;
98
6bdafbeb
NC
99typedef struct
100{
252b5132
RH
101 lang_statement_header_type header;
102 union etree_union *exp;
103} lang_assignment_statement_type;
104
6bdafbeb
NC
105typedef struct lang_target_statement_struct
106{
252b5132
RH
107 lang_statement_header_type header;
108 const char *target;
109} lang_target_statement_type;
110
6bdafbeb
NC
111typedef struct lang_output_statement_struct
112{
252b5132
RH
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
6bdafbeb
NC
119enum section_type
120{
252b5132 121 normal_section,
7b243801 122 first_overlay_section,
152d792f 123 overlay_section,
252b5132 124 noload_section,
6b86da53 125 noalloc_section,
c212f39d
FS
126 type_section,
127 readonly_section,
128 typed_readonly_section
252b5132
RH
129};
130
6bdafbeb
NC
131/* This structure holds a list of program headers describing
132 segments in which this section should be placed. */
252b5132 133
6bdafbeb
NC
134typedef struct lang_output_section_phdr_list
135{
252b5132
RH
136 struct lang_output_section_phdr_list *next;
137 const char *name;
f38a2680 138 bool used;
6bdafbeb 139} lang_output_section_phdr_list;
252b5132 140
6bdafbeb
NC
141typedef struct lang_output_section_statement_struct
142{
252b5132 143 lang_statement_header_type header;
6e8376fa 144 /* Input sections to be mapped to this output section. */
252b5132 145 lang_statement_list_type children;
6e8376fa
NC
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
afd7a018 150 struct lang_output_section_statement_struct *next;
218868ba 151 struct lang_output_section_statement_struct *prev;
252b5132 152 const char *name;
252b5132 153 asection *bfd_section;
6bdafbeb
NC
154 lang_memory_region_type *region;
155 lang_memory_region_type *lma_region;
2c382fb6 156 fill_type *fill;
7fabd029 157 union etree_union *addr_tree;
252b5132 158 union etree_union *load_base;
3d9c8f6b
AM
159 union etree_union *section_alignment;
160 union etree_union *subsection_alignment;
252b5132 161
9f88b410
RS
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
6bdafbeb 168 lang_output_section_phdr_list *phdrs;
7fabd029 169
b209b5a6
AM
170 /* Used by ELF SHF_LINK_ORDER sorting. */
171 void *data;
172
7fabd029 173 unsigned int block_value;
7fabd029
AM
174 int constraint;
175 flagword flags;
176 enum section_type sectype;
c212f39d 177 etree_type *sectype_value;
cde9e0be
AM
178 unsigned int processed_vma : 1;
179 unsigned int processed_lma : 1;
7fabd029 180 unsigned int all_input_readonly : 1;
49c13adb 181 /* If this section should be ignored. */
e4492aa0 182 unsigned int ignored : 1;
6d8bf25d 183 /* If this section should update "dot". Prevents section being ignored. */
e4492aa0 184 unsigned int update_dot : 1;
d2667025
AM
185 /* If this section is after assignment to _end. */
186 unsigned int after_end : 1;
1eec346e
NC
187 /* If this section uses the alignment of its input sections. */
188 unsigned int align_lma_with_input : 1;
de34d428
AM
189 /* If script has duplicate output section statements of the same name
190 create duplicate output sections. */
191 unsigned int dup_output : 1;
252b5132
RH
192} lang_output_section_statement_type;
193
6bdafbeb
NC
194typedef struct
195{
252b5132 196 lang_statement_header_type header;
2c382fb6 197 fill_type *fill;
252b5132
RH
198 int size;
199 asection *output_section;
200} lang_fill_statement_type;
201
6bdafbeb
NC
202typedef struct
203{
252b5132
RH
204 lang_statement_header_type header;
205 unsigned int type;
89cdebba 206 union etree_union *exp;
252b5132
RH
207 bfd_vma value;
208 asection *output_section;
7fabd029 209 bfd_vma output_offset;
252b5132
RH
210} lang_data_statement_type;
211
212/* Generate a reloc in the output file. */
213
6bdafbeb
NC
214typedef struct
215{
252b5132
RH
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
6bdafbeb
NC
224 /* Section to generate reloc against.
225 Exactly one of section and name must be NULL. */
252b5132
RH
226 asection *section;
227
6bdafbeb
NC
228 /* Name of symbol to generate reloc against.
229 Exactly one of section and name must be NULL. */
252b5132
RH
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
7fabd029
AM
241 /* Offset within output section. */
242 bfd_vma output_offset;
252b5132
RH
243} lang_reloc_statement_type;
244
66be1055 245struct lang_input_statement_flags
6bdafbeb 246{
66be1055 247 /* 1 means this file was specified in a -l option. */
b7f95647 248 unsigned int maybe_archive : 1;
5cc18311 249
d4ae5fb0
AM
250 /* 1 means this file was specified in a -l:namespec option. */
251 unsigned int full_name_provided : 1;
252
252b5132 253 /* 1 means search a set of directories for this file. */
66be1055 254 unsigned int search_dirs : 1;
5cc18311 255
f4a23d42 256 /* 1 means this was found when processing a script in the sysroot. */
409d7240 257 unsigned int sysrooted : 1;
e3f2db7f 258
252b5132
RH
259 /* 1 means this is base file of incremental load.
260 Do not load this file's text or data.
5cc18311 261 Also default text_start to after this file's bss. */
66be1055 262 unsigned int just_syms : 1;
252b5132
RH
263
264 /* Whether to search for this entry as a dynamic archive. */
409d7240 265 unsigned int dynamic : 1;
252b5132 266
15fc2e13
AM
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. */
ddbb8a31 270 unsigned int add_DT_NEEDED_for_dynamic : 1;
e56f61be 271
15fc2e13
AM
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). */
ddbb8a31 274 unsigned int add_DT_NEEDED_for_regular : 1;
4a43e768 275
252b5132 276 /* Whether to include the entire contents of an archive. */
409d7240 277 unsigned int whole_archive : 1;
252b5132 278
c4b78195 279 /* Set when bfd opening is successful. */
409d7240 280 unsigned int loaded : 1;
5cc18311 281
409d7240 282 unsigned int real : 1;
c4b78195
NC
283
284 /* Set if the file does not exist. */
285 unsigned int missing_file : 1;
5d3236ee 286
e77620a5
AM
287 /* Set if reloading an archive or --as-needed lib. */
288 unsigned int reload : 1;
289
0381901e 290#if BFD_SUPPORTS_PLUGINS
5d3236ee
DK
291 /* Set if the file was claimed by a plugin. */
292 unsigned int claimed : 1;
293
8543fde5
DK
294 /* Set if the file was claimed from an archive. */
295 unsigned int claim_archive : 1;
6ecc44f6
AM
296
297 /* Set if added by the lto plugin add_input_file callback. */
298 unsigned int lto_output : 1;
0381901e 299#endif /* BFD_SUPPORTS_PLUGINS */
26278bb8
UD
300
301 /* Head of list of pushed flags. */
302 struct lang_input_statement_flags *pushed;
66be1055
AM
303};
304
305typedef 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;
a6ad7914
AM
314 /* Name to use when sorting. */
315 const char *sort_key;
16171946
FS
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;
66be1055
AM
319
320 bfd *the_bfd;
321
1ff6de03
NA
322 ctf_archive_t *the_ctf;
323
66be1055
AM
324 struct flag_info *section_flag_list;
325
e368bf56 326 /* Next pointer for file_chain statement list. */
36983a93 327 struct lang_input_statement_struct *next;
66be1055 328
e368bf56 329 /* Next pointer for input_file_chain statement list. */
36983a93 330 struct lang_input_statement_struct *next_real_file;
66be1055
AM
331
332 const char *target;
8543fde5 333
66be1055 334 struct lang_input_statement_flags flags;
252b5132
RH
335} lang_input_statement_type;
336
6bdafbeb
NC
337typedef struct
338{
252b5132
RH
339 lang_statement_header_type header;
340 asection *section;
b209b5a6 341 void *pattern;
5cc18311 342} lang_input_section_type;
252b5132 343
43ae96e9
MM
344typedef 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
7dd9c6eb
AM
352struct map_symbol_def {
353 struct bfd_link_hash_entry *entry;
354 struct map_symbol_def *next;
355};
356
6fcc66ab
AM
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. */
359typedef 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
f38a2680 366static inline bool
00f93c44
AM
367bfd_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}
6fcc66ab 372
72223188
JJ
373typedef struct lang_wild_statement_struct lang_wild_statement_type;
374
375typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
8c4645b4 376 asection *, lang_input_statement_type *, void *);
72223188
JJ
377
378typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *,
379 lang_input_statement_type *,
380 callback_t callback,
381 void *data);
382
f38a2680
AM
383typedef bool (*lang_match_sec_type_func) (bfd *, const asection *,
384 bfd *, const asection *);
390fbbf1 385
e6f2cbf5
L
386/* Binary search tree structure to efficiently sort sections by
387 name. */
388typedef struct lang_section_bst
389{
390 asection *section;
b209b5a6 391 void *pattern;
e6f2cbf5
L
392 struct lang_section_bst *left;
393 struct lang_section_bst *right;
394} lang_section_bst_type;
395
72223188 396struct lang_wild_statement_struct
6bdafbeb 397{
85921e9a
NC
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;
72223188 411};
252b5132 412
6bdafbeb
NC
413typedef struct lang_address_statement_struct
414{
252b5132 415 lang_statement_header_type header;
89cdebba
KH
416 const char *section_name;
417 union etree_union *address;
ba916c8a 418 const segment_type *segment;
252b5132
RH
419} lang_address_statement_type;
420
6bdafbeb
NC
421typedef struct
422{
252b5132
RH
423 lang_statement_header_type header;
424 bfd_vma output_offset;
1a69ff95 425 bfd_size_type size;
252b5132 426 asection *output_section;
2c382fb6 427 fill_type *fill;
252b5132
RH
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
6bdafbeb
NC
435typedef struct
436{
252b5132
RH
437 lang_statement_header_type header;
438 lang_statement_list_type children;
439} lang_group_statement_type;
440
53d25da6
AM
441typedef struct
442{
443 lang_statement_header_type header;
444 const char *where;
f38a2680 445 bool is_before;
53d25da6
AM
446} lang_insert_statement_type;
447
6bdafbeb
NC
448typedef union lang_statement_union
449{
252b5132 450 lang_statement_header_type header;
252b5132 451 lang_address_statement_type address_statement;
252b5132 452 lang_assignment_statement_type assignment_statement;
dc02848a 453 lang_data_statement_type data_statement;
252b5132 454 lang_fill_statement_type fill_statement;
252b5132 455 lang_group_statement_type group_statement;
dc02848a 456 lang_input_section_type input_section;
43ae96e9 457 lang_input_matcher_type input_matcher;
dc02848a 458 lang_input_statement_type input_statement;
53d25da6 459 lang_insert_statement_type insert_statement;
dc02848a
AM
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;
252b5132
RH
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
6bdafbeb
NC
471struct lang_phdr
472{
252b5132
RH
473 struct lang_phdr *next;
474 const char *name;
475 unsigned long type;
f38a2680
AM
476 bool filehdr;
477 bool phdrs;
252b5132
RH
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
6bdafbeb
NC
485typedef struct lang_nocrossref
486{
252b5132
RH
487 struct lang_nocrossref *next;
488 const char *name;
6bdafbeb 489} lang_nocrossref_type;
252b5132
RH
490
491/* The list of nocrossref lists. */
492
6bdafbeb
NC
493struct lang_nocrossrefs
494{
252b5132 495 struct lang_nocrossrefs *next;
6bdafbeb 496 lang_nocrossref_type *list;
f38a2680 497 bool onlyfirst;
252b5132
RH
498};
499
577a0623
AM
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
6bdafbeb
NC
503struct unique_sections
504{
577a0623
AM
505 struct unique_sections *next;
506 const char *name;
507};
508
afd7a018
AM
509/* Used by place_orphan to keep track of orphan sections and statements. */
510
4a93e180
NC
511struct orphan_save
512{
afd7a018
AM
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
16e4ecc0
AM
521struct asneeded_minfo
522{
523 struct asneeded_minfo *next;
524 const char *soname;
525 bfd *ref;
526 const char *name;
527};
528
66be1055
AM
529extern struct lang_phdr *lang_phdr_list;
530extern struct lang_nocrossrefs *nocrossref_list;
8be573a7 531extern const char *output_target;
252b5132 532extern lang_output_section_statement_type *abs_output_section;
5c1e6d53 533extern lang_statement_list_type lang_os_list;
66be1055 534extern struct lang_input_statement_flags input_flags;
f38a2680 535extern bool lang_has_input_file;
b209b5a6 536extern lang_statement_list_type statement_list;
252b5132 537extern lang_statement_list_type *stat_ptr;
f38a2680 538extern bool delete_output_file_on_failure;
2d5783fa 539extern bool enable_linker_version;
252b5132 540
e3e942e9 541extern struct bfd_sym_chain entry_symbol;
1e281515 542extern const char *entry_section;
f38a2680 543extern bool entry_from_cmdline;
b71e2778 544extern lang_statement_list_type file_chain;
dc27aea4 545extern lang_statement_list_type input_file_chain;
252b5132 546
37a141bf
FS
547extern struct bfd_elf_dynamic_list **current_dynamic_list_p;
548
420e579c 549extern int lang_statement_iteration;
16e4ecc0 550extern struct asneeded_minfo **asneeded_list_tail;
420e579c 551
eae25ec5
HPN
552extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *);
553
f53154de 554extern void lang_init
9b854f16 555 (bool);
750877ba
L
556extern void lang_finish
557 (void);
4a93e180 558extern lang_memory_region_type * lang_memory_region_lookup
f38a2680 559 (const char * const, bool);
4a93e180
NC
560extern void lang_memory_region_alias
561 (const char *, const char *);
f53154de 562extern void lang_map
1579bae1 563 (void);
f53154de 564extern void lang_set_flags
1579bae1 565 (lang_memory_region_type *, const char *, int);
f53154de 566extern void lang_add_output
1579bae1 567 (const char *, int from_script);
aea4bd9d 568extern lang_output_section_statement_type *lang_enter_output_section_statement
1eec346e 569 (const char *, etree_type *, enum section_type, etree_type *, etree_type *,
c212f39d 570 etree_type *, etree_type *, int, int);
f53154de 571extern void lang_final
1579bae1 572 (void);
eaeb0a9d 573extern void lang_relax_sections
f38a2680 574 (bool);
f53154de 575extern void lang_process
1579bae1 576 (void);
f53154de 577extern void lang_section_start
ba916c8a 578 (const char *, union etree_union *, const segment_type *);
f53154de 579extern void lang_add_entry
f38a2680 580 (const char *, bool);
a359509e
ZW
581extern void lang_default_entry
582 (const char *);
f53154de 583extern void lang_add_target
1579bae1 584 (const char *);
252b5132 585extern void lang_add_wild
f38a2680 586 (struct wildcard_spec *, struct wildcard_list *, bool);
f53154de 587extern void lang_add_map
1579bae1 588 (const char *);
f53154de 589extern void lang_add_fill
1579bae1
AM
590 (fill_type *);
591extern lang_assignment_statement_type *lang_add_assignment
592 (union etree_union *);
f53154de 593extern void lang_add_attribute
1579bae1 594 (enum statement_enum);
f53154de 595extern void lang_startup
1579bae1 596 (const char *);
f53154de 597extern void lang_float
f38a2680 598 (bool);
252b5132 599extern void lang_leave_output_section_statement
6bdafbeb 600 (fill_type *, const char *, lang_output_section_phdr_list *,
1579bae1 601 const char *);
252b5132 602extern void lang_for_each_input_file
1579bae1 603 (void (*dothis) (lang_input_statement_type *));
252b5132 604extern void lang_for_each_file
1579bae1 605 (void (*dothis) (lang_input_statement_type *));
f53154de 606extern void lang_reset_memory_regions
1579bae1 607 (void);
f2241121 608extern void lang_do_assignments
2f65ac72 609 (lang_phase_type);
d2667025
AM
610extern asection *section_for_dot
611 (void);
252b5132 612
f53154de
AM
613#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
614 lang_input_statement_type *statement; \
b72636de 615 for (statement = (lang_input_statement_type *) file_chain.head; \
1fa4ec6a 616 statement != NULL; \
36983a93 617 statement = statement->next)
5cc18311 618
66c103b7 619#define lang_output_section_find(NAME) \
21401fc7 620 lang_output_section_statement_lookup (NAME, 0, 0)
66c103b7 621
f53154de 622extern void lang_process
1579bae1 623 (void);
f53154de 624extern void ldlang_add_file
1579bae1 625 (lang_input_statement_type *);
afd7a018 626extern lang_output_section_statement_type *lang_output_section_find_by_flags
93638471 627 (const asection *, flagword, lang_output_section_statement_type **,
390fbbf1 628 lang_match_sec_type_func);
afd7a018 629extern lang_output_section_statement_type *lang_insert_orphan
8a99a385 630 (asection *, const char *, int, lang_output_section_statement_type *,
7b986e99 631 struct orphan_save *, etree_type *, lang_statement_list_type *);
252b5132 632extern lang_input_statement_type *lang_add_input_file
1579bae1 633 (const char *, lang_input_file_enum_type, const char *);
f53154de 634extern void lang_add_keepsyms_file
1579bae1 635 (const char *);
24ef1aa7
GM
636extern lang_output_section_statement_type *lang_output_section_get
637 (const asection *);
66c103b7 638extern lang_output_section_statement_type *lang_output_section_statement_lookup
21401fc7 639 (const char *, int, int);
d127ecce
AM
640extern lang_output_section_statement_type *next_matching_output_section_statement
641 (lang_output_section_statement_type *, int);
f53154de 642extern void ldlang_add_undef
f38a2680 643 (const char *const, bool);
0a618243
AB
644extern void ldlang_add_require_defined
645 (const char *const);
f53154de 646extern void lang_add_output_format
1579bae1 647 (const char *, const char *, const char *, int);
f53154de 648extern void lang_list_init
1579bae1 649 (lang_statement_list_type *);
bde18da4
AM
650extern void push_stat_ptr
651 (lang_statement_list_type *);
652extern void pop_stat_ptr
653 (void);
f53154de 654extern void lang_add_data
0d79a2a8
US
655 (int, union etree_union *);
656extern void lang_add_string
a4d5aec7 657 (const char *);
252b5132 658extern void lang_add_reloc
1579bae1
AM
659 (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *,
660 union etree_union *);
252b5132 661extern void lang_for_each_statement
1579bae1 662 (void (*) (lang_statement_union_type *));
8658f989
AM
663extern void lang_for_each_statement_worker
664 (void (*) (lang_statement_union_type *), lang_statement_union_type *);
1579bae1
AM
665extern void *stat_alloc
666 (size_t);
90bea493
AM
667extern void stat_free
668 (void *);
669extern void *stat_memdup
d4115c2c
AM
670 (const void *, size_t, size_t);
671extern char *stat_strdup
672 (const char *);
90bea493
AM
673extern char *stat_concat
674 (const char *, ...);
8423293d
AM
675extern void strip_excluded_output_sections
676 (void);
18cd5bce
AM
677extern void lang_clear_os_map
678 (void);
f53154de 679extern void dprint_statement
1579bae1 680 (lang_statement_union_type *, int);
e9ee469a 681extern void lang_size_sections
f38a2680 682 (bool *, bool);
e9ee469a 683extern void one_lang_size_sections_pass
f38a2680 684 (bool *, bool);
53d25da6
AM
685extern void lang_add_insert
686 (const char *, int);
f53154de 687extern void lang_enter_group
1579bae1 688 (void);
f53154de 689extern void lang_leave_group
1579bae1 690 (void);
39dcfe18 691extern void lang_add_section
b209b5a6 692 (lang_statement_list_type *, asection *, struct wildcard_list *,
b9c361e0 693 struct flag_info *, lang_output_section_statement_type *);
252b5132 694extern void lang_new_phdr
f38a2680 695 (const char *, etree_type *, bool, bool, etree_type *,
1579bae1 696 etree_type *);
f53154de 697extern void lang_add_nocrossref
6bdafbeb 698 (lang_nocrossref_type *);
cdf96953
MF
699extern void lang_add_nocrossref_to
700 (lang_nocrossref_type *);
f53154de 701extern void lang_enter_overlay
7e7d5768 702 (etree_type *, etree_type *);
f53154de 703extern void lang_enter_overlay_section
1579bae1 704 (const char *);
252b5132 705extern void lang_leave_overlay_section
6bdafbeb 706 (fill_type *, lang_output_section_phdr_list *);
252b5132 707extern void lang_leave_overlay
1579bae1 708 (etree_type *, int, fill_type *, const char *,
6bdafbeb 709 lang_output_section_phdr_list *, const char *);
252b5132 710
313e35ee 711extern struct bfd_elf_version_expr *lang_new_vers_pattern
f38a2680 712 (struct bfd_elf_version_expr *, const char *, const char *, bool);
252b5132 713extern struct bfd_elf_version_tree *lang_new_vers_node
1579bae1 714 (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *);
252b5132 715extern struct bfd_elf_version_deps *lang_add_vers_depend
1579bae1 716 (struct bfd_elf_version_deps *, const char *);
252b5132 717extern void lang_register_vers_node
1579bae1 718 (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *);
37a141bf
FS
719extern void lang_append_dynamic_list (struct bfd_elf_dynamic_list **,
720 struct bfd_elf_version_expr *);
55255dae 721extern void lang_append_dynamic_list_cpp_typeinfo (void);
40b36307 722extern void lang_append_dynamic_list_cpp_new (void);
f53154de 723extern void lang_add_unique
1579bae1 724 (const char *);
f53154de 725extern const char *lang_get_output_target
1579bae1 726 (void);
b58f81ae 727extern void add_excluded_libs (const char *);
f38a2680 728extern bool load_symbols
e9f53129 729 (lang_input_statement_type *, lang_statement_list_type *);
b58f81ae 730
1ff6de03
NA
731struct elf_sym_strtab;
732struct elf_strtab_hash;
3d16b64e
NA
733extern void ldlang_ctf_acquire_strings
734 (struct elf_strtab_hash *);
735extern void ldlang_ctf_new_dynsym
736 (int symidx, struct elf_internal_sym *);
1ff6de03
NA
737extern void ldlang_write_ctf_late
738 (void);
f38a2680 739extern bool
2889e75b 740ldlang_override_segment_assignment
f38a2680 741 (struct bfd_link_info *, bfd *, asection *, asection *, bool);
2889e75b 742
01554a74
AM
743extern void
744lang_ld_feature (char *);
745
3604cb1f
TG
746extern void
747lang_print_memory_usage (void);
748
4153b6db
NC
749extern void
750lang_add_gc_name (const char *);
751
f38a2680 752extern bool
2d5783fa 753print_one_symbol (struct bfd_link_hash_entry *, void *);
3edf7b9f 754
2d5783fa
NC
755extern void lang_add_version_string
756 (void);
9b854f16
L
757
758typedef enum
759{
760 cmdline_is_file_enum,
761 cmdline_is_bfd_enum
762} cmdline_enum_type;
763
764typedef struct cmdline_header_struct
765{
766 union cmdline_union *next;
767 cmdline_enum_type type;
768} cmdline_header_type;
769
770typedef struct cmdline_file_struct
771{
772 cmdline_header_type header;
773 const char *filename;
774} cmdline_file_type;
775
776typedef struct cmdline_bfd_struct
777{
778 cmdline_header_type header;
779 bfd *abfd;
780} cmdline_bfd_type;
781
782typedef union cmdline_union
783{
784 cmdline_header_type header;
785 cmdline_file_type file;
786 cmdline_bfd_type abfd;
787} cmdline_union_type;
788
789typedef struct cmdline_list
790{
791 cmdline_union_type *head;
792 cmdline_union_type **tail;
793} cmdline_list_type;
794
795extern void cmdline_emit_object_only_section (void);
796extern void cmdline_check_object_only_section (bfd *, bool);
797extern void cmdline_remove_object_only_files (void);
798
252b5132 799#endif