xref: /openbsd-src/gnu/usr.bin/binutils-2.17/ld/ldlang.h (revision e9e877d162c944d4aeca6c051c2580af7ca87133)
1*3d8817e4Smiod /* ldlang.h - linker command language support
2*3d8817e4Smiod    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3*3d8817e4Smiod    2001, 2002, 2003, 2004, 2005
4*3d8817e4Smiod    Free Software Foundation, Inc.
5*3d8817e4Smiod 
6*3d8817e4Smiod    This file is part of GLD, the Gnu Linker.
7*3d8817e4Smiod 
8*3d8817e4Smiod    GLD is free software; you can redistribute it and/or modify
9*3d8817e4Smiod    it under the terms of the GNU General Public License as published by
10*3d8817e4Smiod    the Free Software Foundation; either version 2, or (at your option)
11*3d8817e4Smiod    any later version.
12*3d8817e4Smiod 
13*3d8817e4Smiod    GLD is distributed in the hope that it will be useful,
14*3d8817e4Smiod    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*3d8817e4Smiod    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*3d8817e4Smiod    GNU General Public License for more details.
17*3d8817e4Smiod 
18*3d8817e4Smiod    You should have received a copy of the GNU General Public License
19*3d8817e4Smiod    along with GLD; see the file COPYING.  If not, write to the Free
20*3d8817e4Smiod    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21*3d8817e4Smiod    02110-1301, USA.  */
22*3d8817e4Smiod 
23*3d8817e4Smiod #ifndef LDLANG_H
24*3d8817e4Smiod #define LDLANG_H
25*3d8817e4Smiod 
26*3d8817e4Smiod #define DEFAULT_MEMORY_REGION   "*default*"
27*3d8817e4Smiod 
28*3d8817e4Smiod typedef enum
29*3d8817e4Smiod {
30*3d8817e4Smiod   lang_input_file_is_l_enum,
31*3d8817e4Smiod   lang_input_file_is_symbols_only_enum,
32*3d8817e4Smiod   lang_input_file_is_marker_enum,
33*3d8817e4Smiod   lang_input_file_is_fake_enum,
34*3d8817e4Smiod   lang_input_file_is_search_file_enum,
35*3d8817e4Smiod   lang_input_file_is_file_enum
36*3d8817e4Smiod } lang_input_file_enum_type;
37*3d8817e4Smiod 
38*3d8817e4Smiod struct _fill_type
39*3d8817e4Smiod {
40*3d8817e4Smiod   size_t size;
41*3d8817e4Smiod   unsigned char data[1];
42*3d8817e4Smiod };
43*3d8817e4Smiod 
44*3d8817e4Smiod typedef struct statement_list
45*3d8817e4Smiod {
46*3d8817e4Smiod   union lang_statement_union *head;
47*3d8817e4Smiod   union lang_statement_union **tail;
48*3d8817e4Smiod } lang_statement_list_type;
49*3d8817e4Smiod 
50*3d8817e4Smiod typedef struct memory_region_struct
51*3d8817e4Smiod {
52*3d8817e4Smiod   char *name;
53*3d8817e4Smiod   struct memory_region_struct *next;
54*3d8817e4Smiod   bfd_vma origin;
55*3d8817e4Smiod   bfd_size_type length;
56*3d8817e4Smiod   bfd_vma current;
57*3d8817e4Smiod   bfd_size_type old_length;
58*3d8817e4Smiod   flagword flags;
59*3d8817e4Smiod   flagword not_flags;
60*3d8817e4Smiod   bfd_boolean had_full_message;
61*3d8817e4Smiod } lang_memory_region_type;
62*3d8817e4Smiod 
63*3d8817e4Smiod typedef struct lang_statement_header_struct
64*3d8817e4Smiod {
65*3d8817e4Smiod   union lang_statement_union *next;
66*3d8817e4Smiod   enum statement_enum
67*3d8817e4Smiod   {
68*3d8817e4Smiod     lang_output_section_statement_enum,
69*3d8817e4Smiod     lang_assignment_statement_enum,
70*3d8817e4Smiod     lang_input_statement_enum,
71*3d8817e4Smiod     lang_address_statement_enum,
72*3d8817e4Smiod     lang_wild_statement_enum,
73*3d8817e4Smiod     lang_input_section_enum,
74*3d8817e4Smiod     lang_object_symbols_statement_enum,
75*3d8817e4Smiod     lang_fill_statement_enum,
76*3d8817e4Smiod     lang_data_statement_enum,
77*3d8817e4Smiod     lang_reloc_statement_enum,
78*3d8817e4Smiod     lang_target_statement_enum,
79*3d8817e4Smiod     lang_output_statement_enum,
80*3d8817e4Smiod     lang_padding_statement_enum,
81*3d8817e4Smiod     lang_group_statement_enum,
82*3d8817e4Smiod 
83*3d8817e4Smiod     lang_afile_asection_pair_statement_enum,
84*3d8817e4Smiod     lang_constructors_statement_enum
85*3d8817e4Smiod   } type;
86*3d8817e4Smiod } lang_statement_header_type;
87*3d8817e4Smiod 
88*3d8817e4Smiod typedef struct
89*3d8817e4Smiod {
90*3d8817e4Smiod   lang_statement_header_type header;
91*3d8817e4Smiod   union etree_union *exp;
92*3d8817e4Smiod } lang_assignment_statement_type;
93*3d8817e4Smiod 
94*3d8817e4Smiod typedef struct lang_target_statement_struct
95*3d8817e4Smiod {
96*3d8817e4Smiod   lang_statement_header_type header;
97*3d8817e4Smiod   const char *target;
98*3d8817e4Smiod } lang_target_statement_type;
99*3d8817e4Smiod 
100*3d8817e4Smiod typedef struct lang_output_statement_struct
101*3d8817e4Smiod {
102*3d8817e4Smiod   lang_statement_header_type header;
103*3d8817e4Smiod   const char *name;
104*3d8817e4Smiod } lang_output_statement_type;
105*3d8817e4Smiod 
106*3d8817e4Smiod /* Section types specified in a linker script.  */
107*3d8817e4Smiod 
108*3d8817e4Smiod enum section_type
109*3d8817e4Smiod {
110*3d8817e4Smiod   normal_section,
111*3d8817e4Smiod   dsect_section,
112*3d8817e4Smiod   copy_section,
113*3d8817e4Smiod   noload_section,
114*3d8817e4Smiod   info_section,
115*3d8817e4Smiod   overlay_section
116*3d8817e4Smiod };
117*3d8817e4Smiod 
118*3d8817e4Smiod /* This structure holds a list of program headers describing
119*3d8817e4Smiod    segments in which this section should be placed.  */
120*3d8817e4Smiod 
121*3d8817e4Smiod typedef struct lang_output_section_phdr_list
122*3d8817e4Smiod {
123*3d8817e4Smiod   struct lang_output_section_phdr_list *next;
124*3d8817e4Smiod   const char *name;
125*3d8817e4Smiod   bfd_boolean used;
126*3d8817e4Smiod } lang_output_section_phdr_list;
127*3d8817e4Smiod 
128*3d8817e4Smiod typedef struct lang_output_section_statement_struct
129*3d8817e4Smiod {
130*3d8817e4Smiod   lang_statement_header_type header;
131*3d8817e4Smiod   lang_statement_list_type children;
132*3d8817e4Smiod   struct lang_output_section_statement_struct *next;
133*3d8817e4Smiod   struct lang_output_section_statement_struct *prev;
134*3d8817e4Smiod   const char *name;
135*3d8817e4Smiod   asection *bfd_section;
136*3d8817e4Smiod   lang_memory_region_type *region;
137*3d8817e4Smiod   lang_memory_region_type *lma_region;
138*3d8817e4Smiod   fill_type *fill;
139*3d8817e4Smiod   union etree_union *addr_tree;
140*3d8817e4Smiod   union etree_union *load_base;
141*3d8817e4Smiod 
142*3d8817e4Smiod   /* If non-null, an expression to evaluate after setting the section's
143*3d8817e4Smiod      size.  The expression is evaluated inside REGION (above) with '.'
144*3d8817e4Smiod      set to the end of the section.  Used in the last overlay section
145*3d8817e4Smiod      to move '.' past all the overlaid sections.  */
146*3d8817e4Smiod   union etree_union *update_dot_tree;
147*3d8817e4Smiod 
148*3d8817e4Smiod   lang_output_section_phdr_list *phdrs;
149*3d8817e4Smiod 
150*3d8817e4Smiod   unsigned int block_value;
151*3d8817e4Smiod   int subsection_alignment;	/* Alignment of components.  */
152*3d8817e4Smiod   int section_alignment;	/* Alignment of start of section.  */
153*3d8817e4Smiod   int constraint;
154*3d8817e4Smiod   flagword flags;
155*3d8817e4Smiod   enum section_type sectype;
156*3d8817e4Smiod   unsigned int processed : 1;
157*3d8817e4Smiod   unsigned int all_input_readonly : 1;
158*3d8817e4Smiod   unsigned int ignored : 1;
159*3d8817e4Smiod } lang_output_section_statement_type;
160*3d8817e4Smiod 
161*3d8817e4Smiod typedef struct
162*3d8817e4Smiod {
163*3d8817e4Smiod   lang_statement_header_type header;
164*3d8817e4Smiod } lang_common_statement_type;
165*3d8817e4Smiod 
166*3d8817e4Smiod typedef struct
167*3d8817e4Smiod {
168*3d8817e4Smiod   lang_statement_header_type header;
169*3d8817e4Smiod } lang_object_symbols_statement_type;
170*3d8817e4Smiod 
171*3d8817e4Smiod typedef struct
172*3d8817e4Smiod {
173*3d8817e4Smiod   lang_statement_header_type header;
174*3d8817e4Smiod   fill_type *fill;
175*3d8817e4Smiod   int size;
176*3d8817e4Smiod   asection *output_section;
177*3d8817e4Smiod } lang_fill_statement_type;
178*3d8817e4Smiod 
179*3d8817e4Smiod typedef struct
180*3d8817e4Smiod {
181*3d8817e4Smiod   lang_statement_header_type header;
182*3d8817e4Smiod   unsigned int type;
183*3d8817e4Smiod   union etree_union *exp;
184*3d8817e4Smiod   bfd_vma value;
185*3d8817e4Smiod   asection *output_section;
186*3d8817e4Smiod   bfd_vma output_offset;
187*3d8817e4Smiod } lang_data_statement_type;
188*3d8817e4Smiod 
189*3d8817e4Smiod /* Generate a reloc in the output file.  */
190*3d8817e4Smiod 
191*3d8817e4Smiod typedef struct
192*3d8817e4Smiod {
193*3d8817e4Smiod   lang_statement_header_type header;
194*3d8817e4Smiod 
195*3d8817e4Smiod   /* Reloc to generate.  */
196*3d8817e4Smiod   bfd_reloc_code_real_type reloc;
197*3d8817e4Smiod 
198*3d8817e4Smiod   /* Reloc howto structure.  */
199*3d8817e4Smiod   reloc_howto_type *howto;
200*3d8817e4Smiod 
201*3d8817e4Smiod   /* Section to generate reloc against.
202*3d8817e4Smiod      Exactly one of section and name must be NULL.  */
203*3d8817e4Smiod   asection *section;
204*3d8817e4Smiod 
205*3d8817e4Smiod   /* Name of symbol to generate reloc against.
206*3d8817e4Smiod      Exactly one of section and name must be NULL.  */
207*3d8817e4Smiod   const char *name;
208*3d8817e4Smiod 
209*3d8817e4Smiod   /* Expression for addend.  */
210*3d8817e4Smiod   union etree_union *addend_exp;
211*3d8817e4Smiod 
212*3d8817e4Smiod   /* Resolved addend.  */
213*3d8817e4Smiod   bfd_vma addend_value;
214*3d8817e4Smiod 
215*3d8817e4Smiod   /* Output section where reloc should be performed.  */
216*3d8817e4Smiod   asection *output_section;
217*3d8817e4Smiod 
218*3d8817e4Smiod   /* Offset within output section.  */
219*3d8817e4Smiod   bfd_vma output_offset;
220*3d8817e4Smiod } lang_reloc_statement_type;
221*3d8817e4Smiod 
222*3d8817e4Smiod typedef struct lang_input_statement_struct
223*3d8817e4Smiod {
224*3d8817e4Smiod   lang_statement_header_type header;
225*3d8817e4Smiod   /* Name of this file.  */
226*3d8817e4Smiod   const char *filename;
227*3d8817e4Smiod   /* Name to use for the symbol giving address of text start.
228*3d8817e4Smiod      Usually the same as filename, but for a file spec'd with
229*3d8817e4Smiod      -l this is the -l switch itself rather than the filename.  */
230*3d8817e4Smiod   const char *local_sym_name;
231*3d8817e4Smiod 
232*3d8817e4Smiod   bfd *the_bfd;
233*3d8817e4Smiod 
234*3d8817e4Smiod   file_ptr passive_position;
235*3d8817e4Smiod 
236*3d8817e4Smiod   /* Symbol table of the file.  */
237*3d8817e4Smiod   asymbol **asymbols;
238*3d8817e4Smiod   unsigned int symbol_count;
239*3d8817e4Smiod 
240*3d8817e4Smiod   /* Point to the next file - whatever it is, wanders up and down
241*3d8817e4Smiod      archives */
242*3d8817e4Smiod   union lang_statement_union *next;
243*3d8817e4Smiod 
244*3d8817e4Smiod   /* Point to the next file, but skips archive contents.  */
245*3d8817e4Smiod   union lang_statement_union *next_real_file;
246*3d8817e4Smiod 
247*3d8817e4Smiod   const char *target;
248*3d8817e4Smiod 
249*3d8817e4Smiod   unsigned int closed : 1;
250*3d8817e4Smiod   unsigned int is_archive : 1;
251*3d8817e4Smiod 
252*3d8817e4Smiod   /* 1 means search a set of directories for this file.  */
253*3d8817e4Smiod   unsigned int search_dirs_flag : 1;
254*3d8817e4Smiod 
255*3d8817e4Smiod   /* 1 means this was found in a search directory marked as sysrooted,
256*3d8817e4Smiod      if search_dirs_flag is false, otherwise, that it should be
257*3d8817e4Smiod      searched in ld_sysroot before any other location, as long as it
258*3d8817e4Smiod      starts with a slash.  */
259*3d8817e4Smiod   unsigned int sysrooted : 1;
260*3d8817e4Smiod 
261*3d8817e4Smiod   /* 1 means this is base file of incremental load.
262*3d8817e4Smiod      Do not load this file's text or data.
263*3d8817e4Smiod      Also default text_start to after this file's bss.  */
264*3d8817e4Smiod   unsigned int just_syms_flag : 1;
265*3d8817e4Smiod 
266*3d8817e4Smiod   /* Whether to search for this entry as a dynamic archive.  */
267*3d8817e4Smiod   unsigned int dynamic : 1;
268*3d8817e4Smiod 
269*3d8817e4Smiod   /* Whether DT_NEEDED tags should be added for dynamic libraries in
270*3d8817e4Smiod      DT_NEEDED tags from this entry.  */
271*3d8817e4Smiod   unsigned int add_needed : 1;
272*3d8817e4Smiod 
273*3d8817e4Smiod   /* Whether this entry should cause a DT_NEEDED tag only when
274*3d8817e4Smiod      satisfying references from regular files, or always.  */
275*3d8817e4Smiod   unsigned int as_needed : 1;
276*3d8817e4Smiod 
277*3d8817e4Smiod   /* Whether to include the entire contents of an archive.  */
278*3d8817e4Smiod   unsigned int whole_archive : 1;
279*3d8817e4Smiod 
280*3d8817e4Smiod   unsigned int loaded : 1;
281*3d8817e4Smiod 
282*3d8817e4Smiod   unsigned int real : 1;
283*3d8817e4Smiod } lang_input_statement_type;
284*3d8817e4Smiod 
285*3d8817e4Smiod typedef struct
286*3d8817e4Smiod {
287*3d8817e4Smiod   lang_statement_header_type header;
288*3d8817e4Smiod   asection *section;
289*3d8817e4Smiod } lang_input_section_type;
290*3d8817e4Smiod 
291*3d8817e4Smiod typedef struct
292*3d8817e4Smiod {
293*3d8817e4Smiod   lang_statement_header_type header;
294*3d8817e4Smiod   asection *section;
295*3d8817e4Smiod   union lang_statement_union *file;
296*3d8817e4Smiod } lang_afile_asection_pair_statement_type;
297*3d8817e4Smiod 
298*3d8817e4Smiod typedef struct lang_wild_statement_struct lang_wild_statement_type;
299*3d8817e4Smiod 
300*3d8817e4Smiod typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
301*3d8817e4Smiod 			    asection *, lang_input_statement_type *, void *);
302*3d8817e4Smiod 
303*3d8817e4Smiod typedef void (*walk_wild_section_handler_t) (lang_wild_statement_type *,
304*3d8817e4Smiod 					     lang_input_statement_type *,
305*3d8817e4Smiod 					     callback_t callback,
306*3d8817e4Smiod 					     void *data);
307*3d8817e4Smiod 
308*3d8817e4Smiod typedef bfd_boolean (*lang_match_sec_type_func) (bfd *, const asection *,
309*3d8817e4Smiod 						 bfd *, const asection *);
310*3d8817e4Smiod 
311*3d8817e4Smiod struct lang_wild_statement_struct
312*3d8817e4Smiod {
313*3d8817e4Smiod   lang_statement_header_type header;
314*3d8817e4Smiod   const char *filename;
315*3d8817e4Smiod   bfd_boolean filenames_sorted;
316*3d8817e4Smiod   struct wildcard_list *section_list;
317*3d8817e4Smiod   bfd_boolean keep_sections;
318*3d8817e4Smiod   lang_statement_list_type children;
319*3d8817e4Smiod 
320*3d8817e4Smiod   walk_wild_section_handler_t walk_wild_section_handler;
321*3d8817e4Smiod   struct wildcard_list *handler_data[4];
322*3d8817e4Smiod };
323*3d8817e4Smiod 
324*3d8817e4Smiod typedef struct lang_address_statement_struct
325*3d8817e4Smiod {
326*3d8817e4Smiod   lang_statement_header_type header;
327*3d8817e4Smiod   const char *section_name;
328*3d8817e4Smiod   union etree_union *address;
329*3d8817e4Smiod   const segment_type *segment;
330*3d8817e4Smiod } lang_address_statement_type;
331*3d8817e4Smiod 
332*3d8817e4Smiod typedef struct
333*3d8817e4Smiod {
334*3d8817e4Smiod   lang_statement_header_type header;
335*3d8817e4Smiod   bfd_vma output_offset;
336*3d8817e4Smiod   size_t size;
337*3d8817e4Smiod   asection *output_section;
338*3d8817e4Smiod   fill_type *fill;
339*3d8817e4Smiod } lang_padding_statement_type;
340*3d8817e4Smiod 
341*3d8817e4Smiod /* A group statement collects a set of libraries together.  The
342*3d8817e4Smiod    libraries are searched multiple times, until no new undefined
343*3d8817e4Smiod    symbols are found.  The effect is to search a group of libraries as
344*3d8817e4Smiod    though they were a single library.  */
345*3d8817e4Smiod 
346*3d8817e4Smiod typedef struct
347*3d8817e4Smiod {
348*3d8817e4Smiod   lang_statement_header_type header;
349*3d8817e4Smiod   lang_statement_list_type children;
350*3d8817e4Smiod } lang_group_statement_type;
351*3d8817e4Smiod 
352*3d8817e4Smiod typedef union lang_statement_union
353*3d8817e4Smiod {
354*3d8817e4Smiod   lang_statement_header_type header;
355*3d8817e4Smiod   lang_wild_statement_type wild_statement;
356*3d8817e4Smiod   lang_data_statement_type data_statement;
357*3d8817e4Smiod   lang_reloc_statement_type reloc_statement;
358*3d8817e4Smiod   lang_address_statement_type address_statement;
359*3d8817e4Smiod   lang_output_section_statement_type output_section_statement;
360*3d8817e4Smiod   lang_afile_asection_pair_statement_type afile_asection_pair_statement;
361*3d8817e4Smiod   lang_assignment_statement_type assignment_statement;
362*3d8817e4Smiod   lang_input_statement_type input_statement;
363*3d8817e4Smiod   lang_target_statement_type target_statement;
364*3d8817e4Smiod   lang_output_statement_type output_statement;
365*3d8817e4Smiod   lang_input_section_type input_section;
366*3d8817e4Smiod   lang_common_statement_type common_statement;
367*3d8817e4Smiod   lang_object_symbols_statement_type object_symbols_statement;
368*3d8817e4Smiod   lang_fill_statement_type fill_statement;
369*3d8817e4Smiod   lang_padding_statement_type padding_statement;
370*3d8817e4Smiod   lang_group_statement_type group_statement;
371*3d8817e4Smiod } lang_statement_union_type;
372*3d8817e4Smiod 
373*3d8817e4Smiod /* This structure holds information about a program header, from the
374*3d8817e4Smiod    PHDRS command in the linker script.  */
375*3d8817e4Smiod 
376*3d8817e4Smiod struct lang_phdr
377*3d8817e4Smiod {
378*3d8817e4Smiod   struct lang_phdr *next;
379*3d8817e4Smiod   const char *name;
380*3d8817e4Smiod   unsigned long type;
381*3d8817e4Smiod   bfd_boolean filehdr;
382*3d8817e4Smiod   bfd_boolean phdrs;
383*3d8817e4Smiod   etree_type *at;
384*3d8817e4Smiod   etree_type *flags;
385*3d8817e4Smiod };
386*3d8817e4Smiod 
387*3d8817e4Smiod /* This structure is used to hold a list of sections which may not
388*3d8817e4Smiod    cross reference each other.  */
389*3d8817e4Smiod 
390*3d8817e4Smiod typedef struct lang_nocrossref
391*3d8817e4Smiod {
392*3d8817e4Smiod   struct lang_nocrossref *next;
393*3d8817e4Smiod   const char *name;
394*3d8817e4Smiod } lang_nocrossref_type;
395*3d8817e4Smiod 
396*3d8817e4Smiod /* The list of nocrossref lists.  */
397*3d8817e4Smiod 
398*3d8817e4Smiod struct lang_nocrossrefs
399*3d8817e4Smiod {
400*3d8817e4Smiod   struct lang_nocrossrefs *next;
401*3d8817e4Smiod   lang_nocrossref_type *list;
402*3d8817e4Smiod };
403*3d8817e4Smiod 
404*3d8817e4Smiod extern struct lang_nocrossrefs *nocrossref_list;
405*3d8817e4Smiod 
406*3d8817e4Smiod /* This structure is used to hold a list of input section names which
407*3d8817e4Smiod    will not match an output section in the linker script.  */
408*3d8817e4Smiod 
409*3d8817e4Smiod struct unique_sections
410*3d8817e4Smiod {
411*3d8817e4Smiod   struct unique_sections *next;
412*3d8817e4Smiod   const char *name;
413*3d8817e4Smiod };
414*3d8817e4Smiod 
415*3d8817e4Smiod /* This structure records symbols for which we need to keep track of
416*3d8817e4Smiod    definedness for use in the DEFINED () test.  */
417*3d8817e4Smiod 
418*3d8817e4Smiod struct lang_definedness_hash_entry
419*3d8817e4Smiod {
420*3d8817e4Smiod   struct bfd_hash_entry root;
421*3d8817e4Smiod   int iteration;
422*3d8817e4Smiod };
423*3d8817e4Smiod 
424*3d8817e4Smiod /* Used by place_orphan to keep track of orphan sections and statements.  */
425*3d8817e4Smiod 
426*3d8817e4Smiod struct orphan_save {
427*3d8817e4Smiod   const char *name;
428*3d8817e4Smiod   flagword flags;
429*3d8817e4Smiod   lang_output_section_statement_type *os;
430*3d8817e4Smiod   asection **section;
431*3d8817e4Smiod   lang_statement_union_type **stmt;
432*3d8817e4Smiod   lang_output_section_statement_type **os_tail;
433*3d8817e4Smiod };
434*3d8817e4Smiod 
435*3d8817e4Smiod extern lang_output_section_statement_type *abs_output_section;
436*3d8817e4Smiod extern lang_statement_list_type lang_output_section_statement;
437*3d8817e4Smiod extern bfd_boolean lang_has_input_file;
438*3d8817e4Smiod extern etree_type *base;
439*3d8817e4Smiod extern lang_statement_list_type *stat_ptr;
440*3d8817e4Smiod extern bfd_boolean delete_output_file_on_failure;
441*3d8817e4Smiod 
442*3d8817e4Smiod extern struct bfd_sym_chain entry_symbol;
443*3d8817e4Smiod extern const char *entry_section;
444*3d8817e4Smiod extern bfd_boolean entry_from_cmdline;
445*3d8817e4Smiod extern lang_statement_list_type file_chain;
446*3d8817e4Smiod 
447*3d8817e4Smiod extern int lang_statement_iteration;
448*3d8817e4Smiod 
449*3d8817e4Smiod extern void lang_init
450*3d8817e4Smiod   (void);
451*3d8817e4Smiod extern void lang_finish
452*3d8817e4Smiod   (void);
453*3d8817e4Smiod extern lang_memory_region_type *lang_memory_region_lookup
454*3d8817e4Smiod   (const char *const, bfd_boolean);
455*3d8817e4Smiod extern lang_memory_region_type *lang_memory_region_default
456*3d8817e4Smiod   (asection *);
457*3d8817e4Smiod extern void lang_map
458*3d8817e4Smiod   (void);
459*3d8817e4Smiod extern void lang_set_flags
460*3d8817e4Smiod   (lang_memory_region_type *, const char *, int);
461*3d8817e4Smiod extern void lang_add_output
462*3d8817e4Smiod   (const char *, int from_script);
463*3d8817e4Smiod extern lang_output_section_statement_type *lang_enter_output_section_statement
464*3d8817e4Smiod   (const char *output_section_statement_name,
465*3d8817e4Smiod    etree_type *address_exp,
466*3d8817e4Smiod    enum section_type sectype,
467*3d8817e4Smiod    etree_type *align,
468*3d8817e4Smiod    etree_type *subalign,
469*3d8817e4Smiod    etree_type *, int);
470*3d8817e4Smiod extern void lang_final
471*3d8817e4Smiod   (void);
472*3d8817e4Smiod extern void lang_process
473*3d8817e4Smiod   (void);
474*3d8817e4Smiod extern void lang_section_start
475*3d8817e4Smiod   (const char *, union etree_union *, const segment_type *);
476*3d8817e4Smiod extern void lang_add_entry
477*3d8817e4Smiod   (const char *, bfd_boolean);
478*3d8817e4Smiod extern void lang_default_entry
479*3d8817e4Smiod   (const char *);
480*3d8817e4Smiod extern void lang_add_target
481*3d8817e4Smiod   (const char *);
482*3d8817e4Smiod extern void lang_add_wild
483*3d8817e4Smiod   (struct wildcard_spec *, struct wildcard_list *, bfd_boolean);
484*3d8817e4Smiod extern void lang_add_map
485*3d8817e4Smiod   (const char *);
486*3d8817e4Smiod extern void lang_add_fill
487*3d8817e4Smiod   (fill_type *);
488*3d8817e4Smiod extern lang_assignment_statement_type *lang_add_assignment
489*3d8817e4Smiod   (union etree_union *);
490*3d8817e4Smiod extern void lang_add_attribute
491*3d8817e4Smiod   (enum statement_enum);
492*3d8817e4Smiod extern void lang_startup
493*3d8817e4Smiod   (const char *);
494*3d8817e4Smiod extern void lang_float
495*3d8817e4Smiod   (bfd_boolean);
496*3d8817e4Smiod extern void lang_leave_output_section_statement
497*3d8817e4Smiod   (fill_type *, const char *, lang_output_section_phdr_list *,
498*3d8817e4Smiod    const char *);
499*3d8817e4Smiod extern void lang_abs_symbol_at_end_of
500*3d8817e4Smiod   (const char *, const char *);
501*3d8817e4Smiod extern void lang_abs_symbol_at_beginning_of
502*3d8817e4Smiod   (const char *, const char *);
503*3d8817e4Smiod extern void lang_statement_append
504*3d8817e4Smiod   (lang_statement_list_type *, lang_statement_union_type *,
505*3d8817e4Smiod    lang_statement_union_type **);
506*3d8817e4Smiod extern void lang_for_each_input_file
507*3d8817e4Smiod   (void (*dothis) (lang_input_statement_type *));
508*3d8817e4Smiod extern void lang_for_each_file
509*3d8817e4Smiod   (void (*dothis) (lang_input_statement_type *));
510*3d8817e4Smiod extern void lang_reset_memory_regions
511*3d8817e4Smiod   (void);
512*3d8817e4Smiod extern void lang_do_assignments
513*3d8817e4Smiod   (void);
514*3d8817e4Smiod 
515*3d8817e4Smiod #define LANG_FOR_EACH_INPUT_STATEMENT(statement)			\
516*3d8817e4Smiod   lang_input_statement_type *statement;					\
517*3d8817e4Smiod   for (statement = (lang_input_statement_type *) file_chain.head;	\
518*3d8817e4Smiod        statement != (lang_input_statement_type *) NULL;			\
519*3d8817e4Smiod        statement = (lang_input_statement_type *) statement->next)	\
520*3d8817e4Smiod 
521*3d8817e4Smiod extern void lang_process
522*3d8817e4Smiod   (void);
523*3d8817e4Smiod extern void ldlang_add_file
524*3d8817e4Smiod   (lang_input_statement_type *);
525*3d8817e4Smiod extern lang_output_section_statement_type *lang_output_section_find
526*3d8817e4Smiod   (const char * const);
527*3d8817e4Smiod extern lang_output_section_statement_type *lang_output_section_find_by_flags
528*3d8817e4Smiod   (const asection *, lang_output_section_statement_type **,
529*3d8817e4Smiod    lang_match_sec_type_func);
530*3d8817e4Smiod extern lang_output_section_statement_type *lang_insert_orphan
531*3d8817e4Smiod   (asection *, const char *, lang_output_section_statement_type *,
532*3d8817e4Smiod    struct orphan_save *, etree_type *, lang_statement_list_type *);
533*3d8817e4Smiod extern lang_input_statement_type *lang_add_input_file
534*3d8817e4Smiod   (const char *, lang_input_file_enum_type, const char *);
535*3d8817e4Smiod extern void lang_add_keepsyms_file
536*3d8817e4Smiod   (const char *);
537*3d8817e4Smiod extern lang_output_section_statement_type *
538*3d8817e4Smiod   lang_output_section_statement_lookup
539*3d8817e4Smiod   (const char *const);
540*3d8817e4Smiod extern void ldlang_add_undef
541*3d8817e4Smiod   (const char *const);
542*3d8817e4Smiod extern void lang_add_output_format
543*3d8817e4Smiod   (const char *, const char *, const char *, int);
544*3d8817e4Smiod extern void lang_list_init
545*3d8817e4Smiod   (lang_statement_list_type *);
546*3d8817e4Smiod extern void lang_add_data
547*3d8817e4Smiod   (int type, union etree_union *);
548*3d8817e4Smiod extern void lang_add_reloc
549*3d8817e4Smiod   (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *,
550*3d8817e4Smiod    union etree_union *);
551*3d8817e4Smiod extern void lang_for_each_statement
552*3d8817e4Smiod   (void (*) (lang_statement_union_type *));
553*3d8817e4Smiod extern void *stat_alloc
554*3d8817e4Smiod   (size_t);
555*3d8817e4Smiod extern void strip_excluded_output_sections
556*3d8817e4Smiod   (void);
557*3d8817e4Smiod extern void dprint_statement
558*3d8817e4Smiod   (lang_statement_union_type *, int);
559*3d8817e4Smiod extern void lang_size_sections
560*3d8817e4Smiod   (bfd_boolean *, bfd_boolean);
561*3d8817e4Smiod extern void one_lang_size_sections_pass
562*3d8817e4Smiod   (bfd_boolean *, bfd_boolean);
563*3d8817e4Smiod extern void lang_enter_group
564*3d8817e4Smiod   (void);
565*3d8817e4Smiod extern void lang_leave_group
566*3d8817e4Smiod   (void);
567*3d8817e4Smiod extern void lang_add_section
568*3d8817e4Smiod   (lang_statement_list_type *, asection *,
569*3d8817e4Smiod    lang_output_section_statement_type *);
570*3d8817e4Smiod extern void lang_new_phdr
571*3d8817e4Smiod   (const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *,
572*3d8817e4Smiod    etree_type *);
573*3d8817e4Smiod extern void lang_add_nocrossref
574*3d8817e4Smiod   (lang_nocrossref_type *);
575*3d8817e4Smiod extern void lang_enter_overlay
576*3d8817e4Smiod   (etree_type *, etree_type *);
577*3d8817e4Smiod extern void lang_enter_overlay_section
578*3d8817e4Smiod   (const char *);
579*3d8817e4Smiod extern void lang_leave_overlay_section
580*3d8817e4Smiod   (fill_type *, lang_output_section_phdr_list *);
581*3d8817e4Smiod extern void lang_leave_overlay
582*3d8817e4Smiod   (etree_type *, int, fill_type *, const char *,
583*3d8817e4Smiod    lang_output_section_phdr_list *, const char *);
584*3d8817e4Smiod 
585*3d8817e4Smiod extern struct bfd_elf_version_tree *lang_elf_version_info;
586*3d8817e4Smiod 
587*3d8817e4Smiod extern struct bfd_elf_version_expr *lang_new_vers_pattern
588*3d8817e4Smiod   (struct bfd_elf_version_expr *, const char *, const char *, bfd_boolean);
589*3d8817e4Smiod extern struct bfd_elf_version_tree *lang_new_vers_node
590*3d8817e4Smiod   (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *);
591*3d8817e4Smiod extern struct bfd_elf_version_deps *lang_add_vers_depend
592*3d8817e4Smiod   (struct bfd_elf_version_deps *, const char *);
593*3d8817e4Smiod extern void lang_register_vers_node
594*3d8817e4Smiod   (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *);
595*3d8817e4Smiod bfd_boolean unique_section_p
596*3d8817e4Smiod   (const asection *);
597*3d8817e4Smiod extern void lang_add_unique
598*3d8817e4Smiod   (const char *);
599*3d8817e4Smiod extern const char *lang_get_output_target
600*3d8817e4Smiod   (void);
601*3d8817e4Smiod extern void lang_track_definedness (const char *);
602*3d8817e4Smiod extern int lang_symbol_definition_iteration (const char *);
603*3d8817e4Smiod extern void lang_update_definedness
604*3d8817e4Smiod   (const char *, struct bfd_link_hash_entry *);
605*3d8817e4Smiod 
606*3d8817e4Smiod extern void add_excluded_libs (const char *);
607*3d8817e4Smiod 
608*3d8817e4Smiod #endif
609