xref: /openbsd-src/gnu/usr.bin/binutils/ld/ldlang.h (revision 007c2a4539b8b8aaa95c5e73e77620090abe113b)
12159047fSniklas /* ldlang.h - linker command language support
2b55d4692Sfgsch    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3*007c2a45Smiod    2001, 2002, 2003, 2004
4b305b0f1Sespie    Free Software Foundation, Inc.
52159047fSniklas 
62159047fSniklas    This file is part of GLD, the Gnu Linker.
72159047fSniklas 
82159047fSniklas    GLD is free software; you can redistribute it and/or modify
92159047fSniklas    it under the terms of the GNU General Public License as published by
10c074d1c9Sdrahn    the Free Software Foundation; either version 2, or (at your option)
112159047fSniklas    any later version.
122159047fSniklas 
132159047fSniklas    GLD is distributed in the hope that it will be useful,
142159047fSniklas    but WITHOUT ANY WARRANTY; without even the implied warranty of
152159047fSniklas    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
162159047fSniklas    GNU General Public License for more details.
172159047fSniklas 
182159047fSniklas    You should have received a copy of the GNU General Public License
19b305b0f1Sespie    along with GLD; see the file COPYING.  If not, write to the Free
20b305b0f1Sespie    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21b305b0f1Sespie    02111-1307, USA.  */
222159047fSniklas 
232159047fSniklas #ifndef LDLANG_H
242159047fSniklas #define LDLANG_H
252159047fSniklas 
26*007c2a45Smiod #define DEFAULT_MEMORY_REGION   "*default*"
27*007c2a45Smiod 
28*007c2a45Smiod typedef enum
29*007c2a45Smiod {
302159047fSniklas   lang_input_file_is_l_enum,
312159047fSniklas   lang_input_file_is_symbols_only_enum,
322159047fSniklas   lang_input_file_is_marker_enum,
332159047fSniklas   lang_input_file_is_fake_enum,
342159047fSniklas   lang_input_file_is_search_file_enum,
352159047fSniklas   lang_input_file_is_file_enum
362159047fSniklas } lang_input_file_enum_type;
372159047fSniklas 
38*007c2a45Smiod struct _fill_type
39*007c2a45Smiod {
40c074d1c9Sdrahn   size_t size;
41c074d1c9Sdrahn   unsigned char data[1];
42c074d1c9Sdrahn };
43b55d4692Sfgsch 
44*007c2a45Smiod typedef struct statement_list
45*007c2a45Smiod {
462159047fSniklas   union lang_statement_union *head;
472159047fSniklas   union lang_statement_union **tail;
482159047fSniklas } lang_statement_list_type;
492159047fSniklas 
50*007c2a45Smiod typedef struct memory_region_struct
51*007c2a45Smiod {
522159047fSniklas   char *name;
532159047fSniklas   struct memory_region_struct *next;
542159047fSniklas   bfd_vma origin;
552159047fSniklas   bfd_size_type length;
562159047fSniklas   bfd_vma current;
572159047fSniklas   bfd_size_type old_length;
58b305b0f1Sespie   flagword flags;
59b305b0f1Sespie   flagword not_flags;
60c074d1c9Sdrahn   bfd_boolean had_full_message;
612159047fSniklas } lang_memory_region_type;
622159047fSniklas 
63*007c2a45Smiod typedef struct lang_statement_header_struct
64*007c2a45Smiod {
652159047fSniklas   union lang_statement_union *next;
66*007c2a45Smiod   enum statement_enum
67*007c2a45Smiod   {
682159047fSniklas     lang_output_section_statement_enum,
692159047fSniklas     lang_assignment_statement_enum,
702159047fSniklas     lang_input_statement_enum,
712159047fSniklas     lang_address_statement_enum,
722159047fSniklas     lang_wild_statement_enum,
732159047fSniklas     lang_input_section_enum,
742159047fSniklas     lang_object_symbols_statement_enum,
752159047fSniklas     lang_fill_statement_enum,
762159047fSniklas     lang_data_statement_enum,
772159047fSniklas     lang_reloc_statement_enum,
782159047fSniklas     lang_target_statement_enum,
792159047fSniklas     lang_output_statement_enum,
802159047fSniklas     lang_padding_statement_enum,
812159047fSniklas     lang_group_statement_enum,
822159047fSniklas 
832159047fSniklas     lang_afile_asection_pair_statement_enum,
842159047fSniklas     lang_constructors_statement_enum
852159047fSniklas   } type;
862159047fSniklas } lang_statement_header_type;
872159047fSniklas 
88*007c2a45Smiod typedef struct
89*007c2a45Smiod {
902159047fSniklas   lang_statement_header_type header;
912159047fSniklas   union etree_union *exp;
922159047fSniklas } lang_assignment_statement_type;
932159047fSniklas 
94*007c2a45Smiod typedef struct lang_target_statement_struct
95*007c2a45Smiod {
962159047fSniklas   lang_statement_header_type header;
972159047fSniklas   const char *target;
982159047fSniklas } lang_target_statement_type;
992159047fSniklas 
100*007c2a45Smiod typedef struct lang_output_statement_struct
101*007c2a45Smiod {
1022159047fSniklas   lang_statement_header_type header;
1032159047fSniklas   const char *name;
1042159047fSniklas } lang_output_statement_type;
1052159047fSniklas 
1060c6d0228Sniklas /* Section types specified in a linker script.  */
1070c6d0228Sniklas 
108*007c2a45Smiod enum section_type
109*007c2a45Smiod {
1100c6d0228Sniklas   normal_section,
1110c6d0228Sniklas   dsect_section,
1120c6d0228Sniklas   copy_section,
1130c6d0228Sniklas   noload_section,
1140c6d0228Sniklas   info_section,
1150c6d0228Sniklas   overlay_section
1160c6d0228Sniklas };
1172159047fSniklas 
118*007c2a45Smiod /* This structure holds a list of program headers describing
119*007c2a45Smiod    segments in which this section should be placed.  */
120191aa565Sniklas 
121*007c2a45Smiod typedef struct lang_output_section_phdr_list
122*007c2a45Smiod {
123191aa565Sniklas   struct lang_output_section_phdr_list *next;
124191aa565Sniklas   const char *name;
125c074d1c9Sdrahn   bfd_boolean used;
126*007c2a45Smiod } lang_output_section_phdr_list;
127191aa565Sniklas 
128*007c2a45Smiod typedef struct lang_output_section_statement_struct
129*007c2a45Smiod {
1302159047fSniklas   lang_statement_header_type header;
1312159047fSniklas   union etree_union *addr_tree;
1322159047fSniklas   lang_statement_list_type children;
1332159047fSniklas   const char *memspec;
1342159047fSniklas   union lang_statement_union *next;
1352159047fSniklas   const char *name;
1362159047fSniklas 
137*007c2a45Smiod   int processed;
1382159047fSniklas 
1392159047fSniklas   asection *bfd_section;
140*007c2a45Smiod   flagword flags;		/* Or together of all input sections.  */
1410c6d0228Sniklas   enum section_type sectype;
142*007c2a45Smiod   lang_memory_region_type *region;
143*007c2a45Smiod   lang_memory_region_type *lma_region;
1442159047fSniklas   size_t block_value;
145c074d1c9Sdrahn   fill_type *fill;
1462159047fSniklas 
147*007c2a45Smiod   int subsection_alignment;	/* Alignment of components.  */
148*007c2a45Smiod   int section_alignment;	/* Alignment of start of section.  */
1492159047fSniklas 
1502159047fSniklas   union etree_union *load_base;
151191aa565Sniklas 
152c074d1c9Sdrahn   /* If non-null, an expression to evaluate after setting the section's
153c074d1c9Sdrahn      size.  The expression is evaluated inside REGION (above) with '.'
154c074d1c9Sdrahn      set to the end of the section.  Used in the last overlay section
155c074d1c9Sdrahn      to move '.' past all the overlaid sections.  */
156c074d1c9Sdrahn   union etree_union *update_dot_tree;
157c074d1c9Sdrahn 
158*007c2a45Smiod   lang_output_section_phdr_list *phdrs;
1592159047fSniklas } lang_output_section_statement_type;
1602159047fSniklas 
161*007c2a45Smiod typedef struct
162*007c2a45Smiod {
1632159047fSniklas   lang_statement_header_type header;
1642159047fSniklas } lang_common_statement_type;
1652159047fSniklas 
166*007c2a45Smiod typedef struct
167*007c2a45Smiod {
1682159047fSniklas   lang_statement_header_type header;
1692159047fSniklas } lang_object_symbols_statement_type;
1702159047fSniklas 
171*007c2a45Smiod typedef struct
172*007c2a45Smiod {
1732159047fSniklas   lang_statement_header_type header;
174c074d1c9Sdrahn   fill_type *fill;
1752159047fSniklas   int size;
1762159047fSniklas   asection *output_section;
1772159047fSniklas } lang_fill_statement_type;
1782159047fSniklas 
179*007c2a45Smiod typedef struct
180*007c2a45Smiod {
1812159047fSniklas   lang_statement_header_type header;
1822159047fSniklas   unsigned int type;
1832159047fSniklas   union etree_union *exp;
1842159047fSniklas   bfd_vma value;
1852159047fSniklas   asection *output_section;
1862159047fSniklas   bfd_vma output_vma;
1872159047fSniklas } lang_data_statement_type;
1882159047fSniklas 
1892159047fSniklas /* Generate a reloc in the output file.  */
1902159047fSniklas 
191*007c2a45Smiod typedef struct
192*007c2a45Smiod {
1932159047fSniklas   lang_statement_header_type header;
1942159047fSniklas 
1952159047fSniklas   /* Reloc to generate.  */
1962159047fSniklas   bfd_reloc_code_real_type reloc;
1972159047fSniklas 
1982159047fSniklas   /* Reloc howto structure.  */
1992159047fSniklas   reloc_howto_type *howto;
2002159047fSniklas 
201*007c2a45Smiod   /* Section to generate reloc against.
202*007c2a45Smiod      Exactly one of section and name must be NULL.  */
2032159047fSniklas   asection *section;
2042159047fSniklas 
205*007c2a45Smiod   /* Name of symbol to generate reloc against.
206*007c2a45Smiod      Exactly one of section and name must be NULL.  */
2072159047fSniklas   const char *name;
2082159047fSniklas 
2092159047fSniklas   /* Expression for addend.  */
2102159047fSniklas   union etree_union *addend_exp;
2112159047fSniklas 
2122159047fSniklas   /* Resolved addend.  */
2132159047fSniklas   bfd_vma addend_value;
2142159047fSniklas 
2152159047fSniklas   /* Output section where reloc should be performed.  */
2162159047fSniklas   asection *output_section;
2172159047fSniklas 
2182159047fSniklas   /* VMA within output section.  */
2192159047fSniklas   bfd_vma output_vma;
2202159047fSniklas } lang_reloc_statement_type;
2212159047fSniklas 
222*007c2a45Smiod typedef struct lang_input_statement_struct
223*007c2a45Smiod {
2242159047fSniklas   lang_statement_header_type header;
2252159047fSniklas   /* Name of this file.  */
2262159047fSniklas   const char *filename;
227*007c2a45Smiod   /* Name to use for the symbol giving address of text start.
228*007c2a45Smiod      Usually the same as filename, but for a file spec'd with
229*007c2a45Smiod      -l this is the -l switch itself rather than the filename.  */
2302159047fSniklas   const char *local_sym_name;
2312159047fSniklas 
2322159047fSniklas   bfd *the_bfd;
2332159047fSniklas 
234c074d1c9Sdrahn   bfd_boolean closed;
2352159047fSniklas   file_ptr passive_position;
2362159047fSniklas 
2372159047fSniklas   /* Symbol table of the file.  */
2382159047fSniklas   asymbol **asymbols;
2392159047fSniklas   unsigned int symbol_count;
2402159047fSniklas 
2412159047fSniklas   /* Point to the next file - whatever it is, wanders up and down
2422159047fSniklas      archives */
2432159047fSniklas   union lang_statement_union *next;
244*007c2a45Smiod 
245*007c2a45Smiod   /* Point to the next file, but skips archive contents.  */
2462159047fSniklas   union lang_statement_union *next_real_file;
2472159047fSniklas 
248c074d1c9Sdrahn   bfd_boolean is_archive;
2492159047fSniklas 
2502159047fSniklas   /* 1 means search a set of directories for this file.  */
251c074d1c9Sdrahn   bfd_boolean search_dirs_flag;
252c074d1c9Sdrahn 
253c074d1c9Sdrahn   /* 1 means this was found in a search directory marked as sysrooted,
254c074d1c9Sdrahn      if search_dirs_flag is false, otherwise, that it should be
255c074d1c9Sdrahn      searched in ld_sysroot before any other location, as long as it
256c074d1c9Sdrahn      starts with a slash.  */
257c074d1c9Sdrahn   bfd_boolean sysrooted;
2582159047fSniklas 
2592159047fSniklas   /* 1 means this is base file of incremental load.
2602159047fSniklas      Do not load this file's text or data.
2612159047fSniklas      Also default text_start to after this file's bss.  */
262c074d1c9Sdrahn   bfd_boolean just_syms_flag;
2632159047fSniklas 
2642159047fSniklas   /* Whether to search for this entry as a dynamic archive.  */
265c074d1c9Sdrahn   bfd_boolean dynamic;
2662159047fSniklas 
267*007c2a45Smiod   /* Whether this entry should cause a DT_NEEDED tag only when
268*007c2a45Smiod      satisfying references from regular files, or always.  */
269*007c2a45Smiod   bfd_boolean as_needed;
270*007c2a45Smiod 
271191aa565Sniklas   /* Whether to include the entire contents of an archive.  */
272c074d1c9Sdrahn   bfd_boolean whole_archive;
273191aa565Sniklas 
274c074d1c9Sdrahn   bfd_boolean loaded;
2752159047fSniklas 
276b55d4692Sfgsch #if 0
277b55d4692Sfgsch   unsigned int globals_in_this_file;
278b55d4692Sfgsch #endif
2792159047fSniklas   const char *target;
280c074d1c9Sdrahn   bfd_boolean real;
2812159047fSniklas } lang_input_statement_type;
2822159047fSniklas 
283*007c2a45Smiod typedef struct
284*007c2a45Smiod {
2852159047fSniklas   lang_statement_header_type header;
2862159047fSniklas   asection *section;
2872159047fSniklas   lang_input_statement_type *ifile;
2882159047fSniklas 
2892159047fSniklas } lang_input_section_type;
2902159047fSniklas 
291*007c2a45Smiod typedef struct
292*007c2a45Smiod {
2932159047fSniklas   lang_statement_header_type header;
2942159047fSniklas   asection *section;
2952159047fSniklas   union lang_statement_union *file;
2962159047fSniklas } lang_afile_asection_pair_statement_type;
2972159047fSniklas 
298*007c2a45Smiod typedef struct lang_wild_statement_struct
299*007c2a45Smiod {
3002159047fSniklas   lang_statement_header_type header;
3012159047fSniklas   const char *filename;
302c074d1c9Sdrahn   bfd_boolean filenames_sorted;
303c074d1c9Sdrahn   struct wildcard_list *section_list;
304c074d1c9Sdrahn   bfd_boolean keep_sections;
3052159047fSniklas   lang_statement_list_type children;
3062159047fSniklas } lang_wild_statement_type;
3072159047fSniklas 
308*007c2a45Smiod typedef struct lang_address_statement_struct
309*007c2a45Smiod {
3102159047fSniklas   lang_statement_header_type header;
3112159047fSniklas   const char *section_name;
3122159047fSniklas   union etree_union *address;
3132159047fSniklas } lang_address_statement_type;
3142159047fSniklas 
315*007c2a45Smiod typedef struct
316*007c2a45Smiod {
3172159047fSniklas   lang_statement_header_type header;
3182159047fSniklas   bfd_vma output_offset;
3192159047fSniklas   size_t size;
3202159047fSniklas   asection *output_section;
321c074d1c9Sdrahn   fill_type *fill;
3222159047fSniklas } lang_padding_statement_type;
3232159047fSniklas 
3242159047fSniklas /* A group statement collects a set of libraries together.  The
3252159047fSniklas    libraries are searched multiple times, until no new undefined
3262159047fSniklas    symbols are found.  The effect is to search a group of libraries as
3272159047fSniklas    though they were a single library.  */
3282159047fSniklas 
329*007c2a45Smiod typedef struct
330*007c2a45Smiod {
3312159047fSniklas   lang_statement_header_type header;
3322159047fSniklas   lang_statement_list_type children;
3332159047fSniklas } lang_group_statement_type;
3342159047fSniklas 
335*007c2a45Smiod typedef union lang_statement_union
336*007c2a45Smiod {
3372159047fSniklas   lang_statement_header_type header;
3382159047fSniklas   lang_wild_statement_type wild_statement;
3392159047fSniklas   lang_data_statement_type data_statement;
3402159047fSniklas   lang_reloc_statement_type reloc_statement;
3412159047fSniklas   lang_address_statement_type address_statement;
3422159047fSniklas   lang_output_section_statement_type output_section_statement;
3432159047fSniklas   lang_afile_asection_pair_statement_type afile_asection_pair_statement;
3442159047fSniklas   lang_assignment_statement_type assignment_statement;
3452159047fSniklas   lang_input_statement_type input_statement;
3462159047fSniklas   lang_target_statement_type target_statement;
3472159047fSniklas   lang_output_statement_type output_statement;
3482159047fSniklas   lang_input_section_type input_section;
3492159047fSniklas   lang_common_statement_type common_statement;
3502159047fSniklas   lang_object_symbols_statement_type object_symbols_statement;
3512159047fSniklas   lang_fill_statement_type fill_statement;
3522159047fSniklas   lang_padding_statement_type padding_statement;
3532159047fSniklas   lang_group_statement_type group_statement;
3542159047fSniklas } lang_statement_union_type;
3552159047fSniklas 
356191aa565Sniklas /* This structure holds information about a program header, from the
357191aa565Sniklas    PHDRS command in the linker script.  */
358191aa565Sniklas 
359*007c2a45Smiod struct lang_phdr
360*007c2a45Smiod {
361191aa565Sniklas   struct lang_phdr *next;
362191aa565Sniklas   const char *name;
363191aa565Sniklas   unsigned long type;
364c074d1c9Sdrahn   bfd_boolean filehdr;
365c074d1c9Sdrahn   bfd_boolean phdrs;
366191aa565Sniklas   etree_type *at;
367191aa565Sniklas   etree_type *flags;
368191aa565Sniklas };
369191aa565Sniklas 
3700c6d0228Sniklas /* This structure is used to hold a list of sections which may not
3710c6d0228Sniklas    cross reference each other.  */
3720c6d0228Sniklas 
373*007c2a45Smiod typedef struct lang_nocrossref
374*007c2a45Smiod {
3750c6d0228Sniklas   struct lang_nocrossref *next;
3760c6d0228Sniklas   const char *name;
377*007c2a45Smiod } lang_nocrossref_type;
3780c6d0228Sniklas 
3790c6d0228Sniklas /* The list of nocrossref lists.  */
3800c6d0228Sniklas 
381*007c2a45Smiod struct lang_nocrossrefs
382*007c2a45Smiod {
3830c6d0228Sniklas   struct lang_nocrossrefs *next;
384*007c2a45Smiod   lang_nocrossref_type *list;
3850c6d0228Sniklas };
3860c6d0228Sniklas 
3870c6d0228Sniklas extern struct lang_nocrossrefs *nocrossref_list;
3880c6d0228Sniklas 
389b55d4692Sfgsch /* This structure is used to hold a list of input section names which
390b55d4692Sfgsch    will not match an output section in the linker script.  */
391b55d4692Sfgsch 
392*007c2a45Smiod struct unique_sections
393*007c2a45Smiod {
394b55d4692Sfgsch   struct unique_sections *next;
395b55d4692Sfgsch   const char *name;
396b55d4692Sfgsch };
397b55d4692Sfgsch 
398*007c2a45Smiod /* This structure records symbols for which we need to keep track of
399*007c2a45Smiod    definedness for use in the DEFINED () test.  */
400*007c2a45Smiod 
401*007c2a45Smiod struct lang_definedness_hash_entry
402*007c2a45Smiod {
403*007c2a45Smiod   struct bfd_hash_entry root;
404*007c2a45Smiod   int iteration;
405*007c2a45Smiod };
406*007c2a45Smiod 
407b55d4692Sfgsch extern struct unique_sections *unique_section_list;
408b55d4692Sfgsch 
4092159047fSniklas extern lang_output_section_statement_type *abs_output_section;
4106978ef19Sespie extern lang_statement_list_type lang_output_section_statement;
411c074d1c9Sdrahn extern bfd_boolean lang_has_input_file;
4122159047fSniklas extern etree_type *base;
4132159047fSniklas extern lang_statement_list_type *stat_ptr;
414c074d1c9Sdrahn extern bfd_boolean delete_output_file_on_failure;
4152159047fSniklas 
416c074d1c9Sdrahn extern struct bfd_sym_chain entry_symbol;
417c074d1c9Sdrahn extern const char *entry_section;
418c074d1c9Sdrahn extern bfd_boolean entry_from_cmdline;
419b55d4692Sfgsch extern lang_statement_list_type file_chain;
4202159047fSniklas 
421*007c2a45Smiod extern int lang_statement_iteration;
422*007c2a45Smiod 
423c074d1c9Sdrahn extern void lang_init
424*007c2a45Smiod   (void);
425*007c2a45Smiod extern lang_memory_region_type *lang_memory_region_lookup
426*007c2a45Smiod   (const char *const, bfd_boolean);
427*007c2a45Smiod extern lang_memory_region_type *lang_memory_region_default
428*007c2a45Smiod   (asection *);
429c074d1c9Sdrahn extern void lang_map
430*007c2a45Smiod   (void);
431c074d1c9Sdrahn extern void lang_set_flags
432*007c2a45Smiod   (lang_memory_region_type *, const char *, int);
433c074d1c9Sdrahn extern void lang_add_output
434*007c2a45Smiod   (const char *, int from_script);
4356978ef19Sespie extern lang_output_section_statement_type *lang_enter_output_section_statement
436*007c2a45Smiod   (const char *output_section_statement_name,
4372159047fSniklas    etree_type *address_exp,
4380c6d0228Sniklas    enum section_type sectype,
4392159047fSniklas    etree_type *align,
4402159047fSniklas    etree_type *subalign,
441*007c2a45Smiod    etree_type *);
442c074d1c9Sdrahn extern void lang_final
443*007c2a45Smiod   (void);
444c074d1c9Sdrahn extern void lang_process
445*007c2a45Smiod   (void);
446c074d1c9Sdrahn extern void lang_section_start
447*007c2a45Smiod   (const char *, union etree_union *);
448c074d1c9Sdrahn extern void lang_add_entry
449*007c2a45Smiod   (const char *, bfd_boolean);
450c074d1c9Sdrahn extern void lang_add_target
451*007c2a45Smiod   (const char *);
452b305b0f1Sespie extern void lang_add_wild
453*007c2a45Smiod   (struct wildcard_spec *, struct wildcard_list *, bfd_boolean);
454c074d1c9Sdrahn extern void lang_add_map
455*007c2a45Smiod   (const char *);
456c074d1c9Sdrahn extern void lang_add_fill
457*007c2a45Smiod   (fill_type *);
458c074d1c9Sdrahn extern lang_assignment_statement_type *lang_add_assignment
459*007c2a45Smiod   (union etree_union *);
460c074d1c9Sdrahn extern void lang_add_attribute
461*007c2a45Smiod   (enum statement_enum);
462c074d1c9Sdrahn extern void lang_startup
463*007c2a45Smiod   (const char *);
464c074d1c9Sdrahn extern void lang_float
465*007c2a45Smiod   (bfd_boolean);
4660c6d0228Sniklas extern void lang_leave_output_section_statement
467*007c2a45Smiod   (fill_type *, const char *, lang_output_section_phdr_list *,
468*007c2a45Smiod    const char *);
469c074d1c9Sdrahn extern void lang_abs_symbol_at_end_of
470*007c2a45Smiod   (const char *, const char *);
471c074d1c9Sdrahn extern void lang_abs_symbol_at_beginning_of
472*007c2a45Smiod   (const char *, const char *);
473c074d1c9Sdrahn extern void lang_statement_append
474*007c2a45Smiod   (lang_statement_list_type *, lang_statement_union_type *,
475*007c2a45Smiod    lang_statement_union_type **);
4762159047fSniklas extern void lang_for_each_input_file
477*007c2a45Smiod   (void (*dothis) (lang_input_statement_type *));
4782159047fSniklas extern void lang_for_each_file
479*007c2a45Smiod   (void (*dothis) (lang_input_statement_type *));
480c074d1c9Sdrahn extern void lang_reset_memory_regions
481*007c2a45Smiod   (void);
482*007c2a45Smiod extern void lang_do_assignments
483*007c2a45Smiod   (lang_statement_union_type *, lang_output_section_statement_type *,
484*007c2a45Smiod    fill_type *, bfd_vma);
4852159047fSniklas 
4862159047fSniklas #define LANG_FOR_EACH_INPUT_STATEMENT(statement)			\
4872159047fSniklas   lang_input_statement_type *statement;					\
4882159047fSniklas   for (statement = (lang_input_statement_type *) file_chain.head;	\
4892159047fSniklas        statement != (lang_input_statement_type *) NULL;			\
4902159047fSniklas        statement = (lang_input_statement_type *) statement->next)	\
4912159047fSniklas 
492c074d1c9Sdrahn extern void lang_process
493*007c2a45Smiod   (void);
494c074d1c9Sdrahn extern void ldlang_add_file
495*007c2a45Smiod   (lang_input_statement_type *);
4962159047fSniklas extern lang_output_section_statement_type *lang_output_section_find
497*007c2a45Smiod   (const char * const);
4982159047fSniklas extern lang_input_statement_type *lang_add_input_file
499*007c2a45Smiod   (const char *, lang_input_file_enum_type, const char *);
500c074d1c9Sdrahn extern void lang_add_keepsyms_file
501*007c2a45Smiod   (const char *);
5022159047fSniklas extern lang_output_section_statement_type *
503c074d1c9Sdrahn   lang_output_section_statement_lookup
504*007c2a45Smiod   (const char *const);
505c074d1c9Sdrahn extern void ldlang_add_undef
506*007c2a45Smiod   (const char *const);
507c074d1c9Sdrahn extern void lang_add_output_format
508*007c2a45Smiod   (const char *, const char *, const char *, int);
509c074d1c9Sdrahn extern void lang_list_init
510*007c2a45Smiod   (lang_statement_list_type *);
511c074d1c9Sdrahn extern void lang_add_data
512*007c2a45Smiod   (int type, union etree_union *);
5132159047fSniklas extern void lang_add_reloc
514*007c2a45Smiod   (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *,
515*007c2a45Smiod    union etree_union *);
5162159047fSniklas extern void lang_for_each_statement
517*007c2a45Smiod   (void (*) (lang_statement_union_type *));
518*007c2a45Smiod extern void *stat_alloc
519*007c2a45Smiod   (size_t);
520c074d1c9Sdrahn extern void dprint_statement
521*007c2a45Smiod   (lang_statement_union_type *, int);
5222159047fSniklas extern bfd_vma lang_size_sections
523*007c2a45Smiod   (lang_statement_union_type *, lang_output_section_statement_type *,
524*007c2a45Smiod    lang_statement_union_type **, fill_type *, bfd_vma, bfd_boolean *,
525*007c2a45Smiod    bfd_boolean);
526c074d1c9Sdrahn extern void lang_enter_group
527*007c2a45Smiod   (void);
528c074d1c9Sdrahn extern void lang_leave_group
529*007c2a45Smiod   (void);
530c074d1c9Sdrahn extern void lang_add_section
531*007c2a45Smiod   (lang_statement_list_type *, asection *,
532*007c2a45Smiod    lang_output_section_statement_type *, lang_input_statement_type *);
533191aa565Sniklas extern void lang_new_phdr
534*007c2a45Smiod   (const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *,
535*007c2a45Smiod    etree_type *);
536c074d1c9Sdrahn extern void lang_add_nocrossref
537*007c2a45Smiod   (lang_nocrossref_type *);
538c074d1c9Sdrahn extern void lang_enter_overlay
539*007c2a45Smiod   (etree_type *, etree_type *);
540c074d1c9Sdrahn extern void lang_enter_overlay_section
541*007c2a45Smiod   (const char *);
5420c6d0228Sniklas extern void lang_leave_overlay_section
543*007c2a45Smiod   (fill_type *, lang_output_section_phdr_list *);
5440c6d0228Sniklas extern void lang_leave_overlay
545*007c2a45Smiod   (etree_type *, int, fill_type *, const char *,
546*007c2a45Smiod    lang_output_section_phdr_list *, const char *);
547b305b0f1Sespie 
548b305b0f1Sespie extern struct bfd_elf_version_tree *lang_elf_version_info;
549b305b0f1Sespie 
550c074d1c9Sdrahn extern struct bfd_elf_version_expr *lang_new_vers_pattern
551*007c2a45Smiod   (struct bfd_elf_version_expr *, const char *, const char *);
552b305b0f1Sespie extern struct bfd_elf_version_tree *lang_new_vers_node
553*007c2a45Smiod   (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *);
554b305b0f1Sespie extern struct bfd_elf_version_deps *lang_add_vers_depend
555*007c2a45Smiod   (struct bfd_elf_version_deps *, const char *);
556b305b0f1Sespie extern void lang_register_vers_node
557*007c2a45Smiod   (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *);
558c074d1c9Sdrahn bfd_boolean unique_section_p
559*007c2a45Smiod   (const char *);
560c074d1c9Sdrahn extern void lang_add_unique
561*007c2a45Smiod   (const char *);
562c074d1c9Sdrahn extern const char *lang_get_output_target
563*007c2a45Smiod   (void);
564*007c2a45Smiod extern void lang_track_definedness (const char *);
565*007c2a45Smiod extern int lang_symbol_definition_iteration (const char *);
566*007c2a45Smiod extern void lang_update_definedness
567*007c2a45Smiod   (const char *, struct bfd_link_hash_entry *);
5682159047fSniklas 
5692159047fSniklas #endif
570