]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/ldlang.h
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / ldlang.h
CommitLineData
252b5132 1/* ldlang.h - linker command language support
fd67aa11 2 Copyright (C) 1991-2024 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;
252b5132 144 lang_statement_list_type children;
afd7a018 145 struct lang_output_section_statement_struct *next;
218868ba 146 struct lang_output_section_statement_struct *prev;
252b5132 147 const char *name;
252b5132 148 asection *bfd_section;
6bdafbeb
NC
149 lang_memory_region_type *region;
150 lang_memory_region_type *lma_region;
2c382fb6 151 fill_type *fill;
7fabd029 152 union etree_union *addr_tree;
252b5132 153 union etree_union *load_base;
3d9c8f6b
AM
154 union etree_union *section_alignment;
155 union etree_union *subsection_alignment;
252b5132 156
9f88b410
RS
157 /* If non-null, an expression to evaluate after setting the section's
158 size. The expression is evaluated inside REGION (above) with '.'
159 set to the end of the section. Used in the last overlay section
160 to move '.' past all the overlaid sections. */
161 union etree_union *update_dot_tree;
162
6bdafbeb 163 lang_output_section_phdr_list *phdrs;
7fabd029 164
b209b5a6
AM
165 /* Used by ELF SHF_LINK_ORDER sorting. */
166 void *data;
167
7fabd029 168 unsigned int block_value;
7fabd029
AM
169 int constraint;
170 flagword flags;
171 enum section_type sectype;
c212f39d 172 etree_type *sectype_value;
cde9e0be
AM
173 unsigned int processed_vma : 1;
174 unsigned int processed_lma : 1;
7fabd029 175 unsigned int all_input_readonly : 1;
49c13adb 176 /* If this section should be ignored. */
e4492aa0 177 unsigned int ignored : 1;
6d8bf25d 178 /* If this section should update "dot". Prevents section being ignored. */
e4492aa0 179 unsigned int update_dot : 1;
d2667025
AM
180 /* If this section is after assignment to _end. */
181 unsigned int after_end : 1;
1eec346e
NC
182 /* If this section uses the alignment of its input sections. */
183 unsigned int align_lma_with_input : 1;
de34d428
AM
184 /* If script has duplicate output section statements of the same name
185 create duplicate output sections. */
186 unsigned int dup_output : 1;
252b5132
RH
187} lang_output_section_statement_type;
188
6bdafbeb
NC
189typedef struct
190{
252b5132 191 lang_statement_header_type header;
2c382fb6 192 fill_type *fill;
252b5132
RH
193 int size;
194 asection *output_section;
195} lang_fill_statement_type;
196
6bdafbeb
NC
197typedef struct
198{
252b5132
RH
199 lang_statement_header_type header;
200 unsigned int type;
89cdebba 201 union etree_union *exp;
252b5132
RH
202 bfd_vma value;
203 asection *output_section;
7fabd029 204 bfd_vma output_offset;
252b5132
RH
205} lang_data_statement_type;
206
207/* Generate a reloc in the output file. */
208
6bdafbeb
NC
209typedef struct
210{
252b5132
RH
211 lang_statement_header_type header;
212
213 /* Reloc to generate. */
214 bfd_reloc_code_real_type reloc;
215
216 /* Reloc howto structure. */
217 reloc_howto_type *howto;
218
6bdafbeb
NC
219 /* Section to generate reloc against.
220 Exactly one of section and name must be NULL. */
252b5132
RH
221 asection *section;
222
6bdafbeb
NC
223 /* Name of symbol to generate reloc against.
224 Exactly one of section and name must be NULL. */
252b5132
RH
225 const char *name;
226
227 /* Expression for addend. */
228 union etree_union *addend_exp;
229
230 /* Resolved addend. */
231 bfd_vma addend_value;
232
233 /* Output section where reloc should be performed. */
234 asection *output_section;
235
7fabd029
AM
236 /* Offset within output section. */
237 bfd_vma output_offset;
252b5132
RH
238} lang_reloc_statement_type;
239
66be1055 240struct lang_input_statement_flags
6bdafbeb 241{
66be1055 242 /* 1 means this file was specified in a -l option. */
b7f95647 243 unsigned int maybe_archive : 1;
5cc18311 244
d4ae5fb0
AM
245 /* 1 means this file was specified in a -l:namespec option. */
246 unsigned int full_name_provided : 1;
247
252b5132 248 /* 1 means search a set of directories for this file. */
66be1055 249 unsigned int search_dirs : 1;
5cc18311 250
f4a23d42 251 /* 1 means this was found when processing a script in the sysroot. */
409d7240 252 unsigned int sysrooted : 1;
e3f2db7f 253
252b5132
RH
254 /* 1 means this is base file of incremental load.
255 Do not load this file's text or data.
5cc18311 256 Also default text_start to after this file's bss. */
66be1055 257 unsigned int just_syms : 1;
252b5132
RH
258
259 /* Whether to search for this entry as a dynamic archive. */
409d7240 260 unsigned int dynamic : 1;
252b5132 261
15fc2e13
AM
262 /* Set if a DT_NEEDED tag should be added not just for the dynamic library
263 explicitly given by this entry but also for any dynamic libraries in
264 this entry's needed list. */
ddbb8a31 265 unsigned int add_DT_NEEDED_for_dynamic : 1;
e56f61be 266
15fc2e13
AM
267 /* Set if this entry should cause a DT_NEEDED tag only when some
268 regular file references its symbols (ie. --as-needed is in effect). */
ddbb8a31 269 unsigned int add_DT_NEEDED_for_regular : 1;
4a43e768 270
252b5132 271 /* Whether to include the entire contents of an archive. */
409d7240 272 unsigned int whole_archive : 1;
252b5132 273
c4b78195 274 /* Set when bfd opening is successful. */
409d7240 275 unsigned int loaded : 1;
5cc18311 276
409d7240 277 unsigned int real : 1;
c4b78195
NC
278
279 /* Set if the file does not exist. */
280 unsigned int missing_file : 1;
5d3236ee 281
e77620a5
AM
282 /* Set if reloading an archive or --as-needed lib. */
283 unsigned int reload : 1;
284
0381901e 285#if BFD_SUPPORTS_PLUGINS
5d3236ee
DK
286 /* Set if the file was claimed by a plugin. */
287 unsigned int claimed : 1;
288
8543fde5
DK
289 /* Set if the file was claimed from an archive. */
290 unsigned int claim_archive : 1;
ce875075
AM
291
292 /* Set if added by the lto plugin add_input_file callback. */
293 unsigned int lto_output : 1;
0381901e 294#endif /* BFD_SUPPORTS_PLUGINS */
26278bb8
UD
295
296 /* Head of list of pushed flags. */
297 struct lang_input_statement_flags *pushed;
66be1055
AM
298};
299
300typedef struct lang_input_statement_struct
301{
302 lang_statement_header_type header;
303 /* Name of this file. */
304 const char *filename;
305 /* Name to use for the symbol giving address of text start.
306 Usually the same as filename, but for a file spec'd with
307 -l this is the -l switch itself rather than the filename. */
308 const char *local_sym_name;
a6ad7914
AM
309 /* Name to use when sorting. */
310 const char *sort_key;
16171946
FS
311 /* Extra search path. Used to find a file relative to the
312 directory of the current linker script. */
313 const char *extra_search_path;
66be1055
AM
314
315 bfd *the_bfd;
316
1ff6de03
NA
317 ctf_archive_t *the_ctf;
318
66be1055
AM
319 struct flag_info *section_flag_list;
320
e368bf56 321 /* Next pointer for file_chain statement list. */
36983a93 322 struct lang_input_statement_struct *next;
66be1055 323
e368bf56 324 /* Next pointer for input_file_chain statement list. */
36983a93 325 struct lang_input_statement_struct *next_real_file;
66be1055
AM
326
327 const char *target;
8543fde5 328
66be1055 329 struct lang_input_statement_flags flags;
252b5132
RH
330} lang_input_statement_type;
331
6bdafbeb
NC
332typedef struct
333{
252b5132
RH
334 lang_statement_header_type header;
335 asection *section;
b209b5a6 336 void *pattern;
5cc18311 337} lang_input_section_type;
252b5132 338
43ae96e9
MM
339typedef struct
340{
341 lang_statement_header_type header;
342 asection *section;
343 void *pattern;
344 lang_input_statement_type *input_stmt;
345} lang_input_matcher_type;
346
7dd9c6eb
AM
347struct map_symbol_def {
348 struct bfd_link_hash_entry *entry;
349 struct map_symbol_def *next;
350};
351
6fcc66ab
AM
352/* For input sections, when writing a map file: head / tail of a linked
353 list of hash table entries for symbols defined in this section. */
354typedef struct input_section_userdata_struct
355{
356 struct map_symbol_def *map_symbol_def_head;
357 struct map_symbol_def **map_symbol_def_tail;
358 unsigned long map_symbol_def_count;
359} input_section_userdata_type;
360
f38a2680 361static inline bool
00f93c44
AM
362bfd_input_just_syms (const bfd *abfd)
363{
364 lang_input_statement_type *is = bfd_usrdata (abfd);
365 return is != NULL && is->flags.just_syms;
366}
6fcc66ab 367
72223188
JJ
368typedef struct lang_wild_statement_struct lang_wild_statement_type;
369
370typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
8c4645b4 371 asection *, lang_input_statement_type *, void *);
72223188
JJ
372
373typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *,
374 lang_input_statement_type *,
375 callback_t callback,
376 void *data);
377
f38a2680
AM
378typedef bool (*lang_match_sec_type_func) (bfd *, const asection *,
379 bfd *, const asection *);
390fbbf1 380
e6f2cbf5
L
381/* Binary search tree structure to efficiently sort sections by
382 name. */
383typedef struct lang_section_bst
384{
385 asection *section;
b209b5a6 386 void *pattern;
e6f2cbf5
L
387 struct lang_section_bst *left;
388 struct lang_section_bst *right;
389} lang_section_bst_type;
390
72223188 391struct lang_wild_statement_struct
6bdafbeb 392{
85921e9a
NC
393 lang_statement_header_type header;
394 lang_statement_list_type children;
395 lang_statement_list_type matching_sections;
396 lang_section_bst_type * tree;
397 lang_section_bst_type ** rightmost;
398 struct wildcard_list * section_list;
399 struct name_list * exclude_name_list;
400 struct flag_info * section_flag_list;
401 const char * filename;
402 bool filenames_sorted;
403 bool filenames_reversed;
404 bool any_specs_sorted;
405 bool keep_sections;
72223188 406};
252b5132 407
6bdafbeb
NC
408typedef struct lang_address_statement_struct
409{
252b5132 410 lang_statement_header_type header;
89cdebba
KH
411 const char *section_name;
412 union etree_union *address;
ba916c8a 413 const segment_type *segment;
252b5132
RH
414} lang_address_statement_type;
415
6bdafbeb
NC
416typedef struct
417{
252b5132
RH
418 lang_statement_header_type header;
419 bfd_vma output_offset;
1a69ff95 420 bfd_size_type size;
252b5132 421 asection *output_section;
2c382fb6 422 fill_type *fill;
252b5132
RH
423} lang_padding_statement_type;
424
425/* A group statement collects a set of libraries together. The
426 libraries are searched multiple times, until no new undefined
427 symbols are found. The effect is to search a group of libraries as
428 though they were a single library. */
429
6bdafbeb
NC
430typedef struct
431{
252b5132
RH
432 lang_statement_header_type header;
433 lang_statement_list_type children;
434} lang_group_statement_type;
435
53d25da6
AM
436typedef struct
437{
438 lang_statement_header_type header;
439 const char *where;
f38a2680 440 bool is_before;
53d25da6
AM
441} lang_insert_statement_type;
442
6bdafbeb
NC
443typedef union lang_statement_union
444{
252b5132 445 lang_statement_header_type header;
252b5132 446 lang_address_statement_type address_statement;
252b5132 447 lang_assignment_statement_type assignment_statement;
dc02848a 448 lang_data_statement_type data_statement;
252b5132 449 lang_fill_statement_type fill_statement;
252b5132 450 lang_group_statement_type group_statement;
dc02848a 451 lang_input_section_type input_section;
43ae96e9 452 lang_input_matcher_type input_matcher;
dc02848a 453 lang_input_statement_type input_statement;
53d25da6 454 lang_insert_statement_type insert_statement;
dc02848a
AM
455 lang_output_section_statement_type output_section_statement;
456 lang_output_statement_type output_statement;
457 lang_padding_statement_type padding_statement;
458 lang_reloc_statement_type reloc_statement;
459 lang_target_statement_type target_statement;
460 lang_wild_statement_type wild_statement;
252b5132
RH
461} lang_statement_union_type;
462
463/* This structure holds information about a program header, from the
464 PHDRS command in the linker script. */
465
6bdafbeb
NC
466struct lang_phdr
467{
252b5132
RH
468 struct lang_phdr *next;
469 const char *name;
470 unsigned long type;
f38a2680
AM
471 bool filehdr;
472 bool phdrs;
252b5132
RH
473 etree_type *at;
474 etree_type *flags;
475};
476
477/* This structure is used to hold a list of sections which may not
478 cross reference each other. */
479
6bdafbeb
NC
480typedef struct lang_nocrossref
481{
252b5132
RH
482 struct lang_nocrossref *next;
483 const char *name;
6bdafbeb 484} lang_nocrossref_type;
252b5132
RH
485
486/* The list of nocrossref lists. */
487
6bdafbeb
NC
488struct lang_nocrossrefs
489{
252b5132 490 struct lang_nocrossrefs *next;
6bdafbeb 491 lang_nocrossref_type *list;
f38a2680 492 bool onlyfirst;
252b5132
RH
493};
494
577a0623
AM
495/* This structure is used to hold a list of input section names which
496 will not match an output section in the linker script. */
497
6bdafbeb
NC
498struct unique_sections
499{
577a0623
AM
500 struct unique_sections *next;
501 const char *name;
502};
503
afd7a018
AM
504/* Used by place_orphan to keep track of orphan sections and statements. */
505
4a93e180
NC
506struct orphan_save
507{
afd7a018
AM
508 const char *name;
509 flagword flags;
510 lang_output_section_statement_type *os;
511 asection **section;
512 lang_statement_union_type **stmt;
513 lang_output_section_statement_type **os_tail;
514};
515
16e4ecc0
AM
516struct asneeded_minfo
517{
518 struct asneeded_minfo *next;
519 const char *soname;
520 bfd *ref;
521 const char *name;
522};
523
66be1055
AM
524extern struct lang_phdr *lang_phdr_list;
525extern struct lang_nocrossrefs *nocrossref_list;
8be573a7 526extern const char *output_target;
252b5132 527extern lang_output_section_statement_type *abs_output_section;
5c1e6d53 528extern lang_statement_list_type lang_os_list;
66be1055 529extern struct lang_input_statement_flags input_flags;
f38a2680 530extern bool lang_has_input_file;
b209b5a6 531extern lang_statement_list_type statement_list;
252b5132 532extern lang_statement_list_type *stat_ptr;
f38a2680 533extern bool delete_output_file_on_failure;
2d5783fa 534extern bool enable_linker_version;
252b5132 535
e3e942e9 536extern struct bfd_sym_chain entry_symbol;
1e281515 537extern const char *entry_section;
f38a2680 538extern bool entry_from_cmdline;
b71e2778 539extern lang_statement_list_type file_chain;
dc27aea4 540extern lang_statement_list_type input_file_chain;
252b5132 541
37a141bf
FS
542extern struct bfd_elf_dynamic_list **current_dynamic_list_p;
543
420e579c 544extern int lang_statement_iteration;
16e4ecc0 545extern struct asneeded_minfo **asneeded_list_tail;
420e579c 546
eae25ec5
HPN
547extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *);
548
f53154de 549extern void lang_init
1579bae1 550 (void);
750877ba
L
551extern void lang_finish
552 (void);
4a93e180 553extern lang_memory_region_type * lang_memory_region_lookup
f38a2680 554 (const char * const, bool);
4a93e180
NC
555extern void lang_memory_region_alias
556 (const char *, const char *);
f53154de 557extern void lang_map
1579bae1 558 (void);
f53154de 559extern void lang_set_flags
1579bae1 560 (lang_memory_region_type *, const char *, int);
f53154de 561extern void lang_add_output
1579bae1 562 (const char *, int from_script);
aea4bd9d 563extern lang_output_section_statement_type *lang_enter_output_section_statement
1eec346e 564 (const char *, etree_type *, enum section_type, etree_type *, etree_type *,
c212f39d 565 etree_type *, etree_type *, int, int);
f53154de 566extern void lang_final
1579bae1 567 (void);
eaeb0a9d 568extern void lang_relax_sections
f38a2680 569 (bool);
f53154de 570extern void lang_process
1579bae1 571 (void);
f53154de 572extern void lang_section_start
ba916c8a 573 (const char *, union etree_union *, const segment_type *);
f53154de 574extern void lang_add_entry
f38a2680 575 (const char *, bool);
a359509e
ZW
576extern void lang_default_entry
577 (const char *);
f53154de 578extern void lang_add_target
1579bae1 579 (const char *);
252b5132 580extern void lang_add_wild
f38a2680 581 (struct wildcard_spec *, struct wildcard_list *, bool);
f53154de 582extern void lang_add_map
1579bae1 583 (const char *);
f53154de 584extern void lang_add_fill
1579bae1
AM
585 (fill_type *);
586extern lang_assignment_statement_type *lang_add_assignment
587 (union etree_union *);
f53154de 588extern void lang_add_attribute
1579bae1 589 (enum statement_enum);
f53154de 590extern void lang_startup
1579bae1 591 (const char *);
f53154de 592extern void lang_float
f38a2680 593 (bool);
252b5132 594extern void lang_leave_output_section_statement
6bdafbeb 595 (fill_type *, const char *, lang_output_section_phdr_list *,
1579bae1 596 const char *);
252b5132 597extern void lang_for_each_input_file
1579bae1 598 (void (*dothis) (lang_input_statement_type *));
252b5132 599extern void lang_for_each_file
1579bae1 600 (void (*dothis) (lang_input_statement_type *));
f53154de 601extern void lang_reset_memory_regions
1579bae1 602 (void);
f2241121 603extern void lang_do_assignments
2f65ac72 604 (lang_phase_type);
d2667025
AM
605extern asection *section_for_dot
606 (void);
252b5132 607
f53154de
AM
608#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
609 lang_input_statement_type *statement; \
b72636de 610 for (statement = (lang_input_statement_type *) file_chain.head; \
1fa4ec6a 611 statement != NULL; \
36983a93 612 statement = statement->next)
5cc18311 613
66c103b7 614#define lang_output_section_find(NAME) \
21401fc7 615 lang_output_section_statement_lookup (NAME, 0, 0)
66c103b7 616
f53154de 617extern void lang_process
1579bae1 618 (void);
f53154de 619extern void ldlang_add_file
1579bae1 620 (lang_input_statement_type *);
afd7a018 621extern lang_output_section_statement_type *lang_output_section_find_by_flags
93638471 622 (const asection *, flagword, lang_output_section_statement_type **,
390fbbf1 623 lang_match_sec_type_func);
afd7a018 624extern lang_output_section_statement_type *lang_insert_orphan
8a99a385 625 (asection *, const char *, int, lang_output_section_statement_type *,
7b986e99 626 struct orphan_save *, etree_type *, lang_statement_list_type *);
252b5132 627extern lang_input_statement_type *lang_add_input_file
1579bae1 628 (const char *, lang_input_file_enum_type, const char *);
f53154de 629extern void lang_add_keepsyms_file
1579bae1 630 (const char *);
24ef1aa7
GM
631extern lang_output_section_statement_type *lang_output_section_get
632 (const asection *);
66c103b7 633extern lang_output_section_statement_type *lang_output_section_statement_lookup
21401fc7 634 (const char *, int, int);
d127ecce
AM
635extern lang_output_section_statement_type *next_matching_output_section_statement
636 (lang_output_section_statement_type *, int);
f53154de 637extern void ldlang_add_undef
f38a2680 638 (const char *const, bool);
0a618243
AB
639extern void ldlang_add_require_defined
640 (const char *const);
f53154de 641extern void lang_add_output_format
1579bae1 642 (const char *, const char *, const char *, int);
f53154de 643extern void lang_list_init
1579bae1 644 (lang_statement_list_type *);
bde18da4
AM
645extern void push_stat_ptr
646 (lang_statement_list_type *);
647extern void pop_stat_ptr
648 (void);
f53154de 649extern void lang_add_data
0d79a2a8
US
650 (int, union etree_union *);
651extern void lang_add_string
a4d5aec7 652 (const char *);
252b5132 653extern void lang_add_reloc
1579bae1
AM
654 (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *,
655 union etree_union *);
252b5132 656extern void lang_for_each_statement
1579bae1 657 (void (*) (lang_statement_union_type *));
8658f989
AM
658extern void lang_for_each_statement_worker
659 (void (*) (lang_statement_union_type *), lang_statement_union_type *);
1579bae1
AM
660extern void *stat_alloc
661 (size_t);
8423293d
AM
662extern void strip_excluded_output_sections
663 (void);
18cd5bce
AM
664extern void lang_clear_os_map
665 (void);
f53154de 666extern void dprint_statement
1579bae1 667 (lang_statement_union_type *, int);
e9ee469a 668extern void lang_size_sections
f38a2680 669 (bool *, bool);
e9ee469a 670extern void one_lang_size_sections_pass
f38a2680 671 (bool *, bool);
53d25da6
AM
672extern void lang_add_insert
673 (const char *, int);
f53154de 674extern void lang_enter_group
1579bae1 675 (void);
f53154de 676extern void lang_leave_group
1579bae1 677 (void);
39dcfe18 678extern void lang_add_section
b209b5a6 679 (lang_statement_list_type *, asection *, struct wildcard_list *,
b9c361e0 680 struct flag_info *, lang_output_section_statement_type *);
252b5132 681extern void lang_new_phdr
f38a2680 682 (const char *, etree_type *, bool, bool, etree_type *,
1579bae1 683 etree_type *);
f53154de 684extern void lang_add_nocrossref
6bdafbeb 685 (lang_nocrossref_type *);
cdf96953
MF
686extern void lang_add_nocrossref_to
687 (lang_nocrossref_type *);
f53154de 688extern void lang_enter_overlay
7e7d5768 689 (etree_type *, etree_type *);
f53154de 690extern void lang_enter_overlay_section
1579bae1 691 (const char *);
252b5132 692extern void lang_leave_overlay_section
6bdafbeb 693 (fill_type *, lang_output_section_phdr_list *);
252b5132 694extern void lang_leave_overlay
1579bae1 695 (etree_type *, int, fill_type *, const char *,
6bdafbeb 696 lang_output_section_phdr_list *, const char *);
252b5132 697
313e35ee 698extern struct bfd_elf_version_expr *lang_new_vers_pattern
f38a2680 699 (struct bfd_elf_version_expr *, const char *, const char *, bool);
252b5132 700extern struct bfd_elf_version_tree *lang_new_vers_node
1579bae1 701 (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *);
252b5132 702extern struct bfd_elf_version_deps *lang_add_vers_depend
1579bae1 703 (struct bfd_elf_version_deps *, const char *);
252b5132 704extern void lang_register_vers_node
1579bae1 705 (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *);
37a141bf
FS
706extern void lang_append_dynamic_list (struct bfd_elf_dynamic_list **,
707 struct bfd_elf_version_expr *);
55255dae 708extern void lang_append_dynamic_list_cpp_typeinfo (void);
40b36307 709extern void lang_append_dynamic_list_cpp_new (void);
f53154de 710extern void lang_add_unique
1579bae1 711 (const char *);
f53154de 712extern const char *lang_get_output_target
1579bae1 713 (void);
b58f81ae 714extern void add_excluded_libs (const char *);
f38a2680 715extern bool load_symbols
e9f53129 716 (lang_input_statement_type *, lang_statement_list_type *);
b58f81ae 717
1ff6de03
NA
718struct elf_sym_strtab;
719struct elf_strtab_hash;
3d16b64e
NA
720extern void ldlang_ctf_acquire_strings
721 (struct elf_strtab_hash *);
722extern void ldlang_ctf_new_dynsym
723 (int symidx, struct elf_internal_sym *);
1ff6de03
NA
724extern void ldlang_write_ctf_late
725 (void);
f38a2680 726extern bool
2889e75b 727ldlang_override_segment_assignment
f38a2680 728 (struct bfd_link_info *, bfd *, asection *, asection *, bool);
2889e75b 729
01554a74
AM
730extern void
731lang_ld_feature (char *);
732
3604cb1f
TG
733extern void
734lang_print_memory_usage (void);
735
4153b6db
NC
736extern void
737lang_add_gc_name (const char *);
738
f38a2680 739extern bool
2d5783fa 740print_one_symbol (struct bfd_link_hash_entry *, void *);
3edf7b9f 741
2d5783fa
NC
742extern void lang_add_version_string
743 (void);
252b5132 744#endif