1 /* ldlang.h - linker command language support
2 Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
4 This file is part of GLD, the Gnu Linker.
6 GLD is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GLD is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GLD; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
25 lang_input_file_is_l_enum
,
26 lang_input_file_is_symbols_only_enum
,
27 lang_input_file_is_marker_enum
,
28 lang_input_file_is_fake_enum
,
29 lang_input_file_is_search_file_enum
,
30 lang_input_file_is_file_enum
31 } lang_input_file_enum_type
;
33 typedef unsigned int fill_type
;
34 typedef struct statement_list
36 union lang_statement_union
*head
;
37 union lang_statement_union
**tail
;
38 } lang_statement_list_type
;
41 typedef struct memory_region_struct
44 struct memory_region_struct
*next
;
48 bfd_size_type old_length
;
50 boolean had_full_message
;
51 } lang_memory_region_type
;
53 typedef struct lang_statement_header_struct
55 union lang_statement_union
*next
;
58 lang_output_section_statement_enum
,
59 lang_assignment_statement_enum
,
60 lang_input_statement_enum
,
61 lang_address_statement_enum
,
62 lang_wild_statement_enum
,
63 lang_input_section_enum
,
64 lang_object_symbols_statement_enum
,
65 lang_fill_statement_enum
,
66 lang_data_statement_enum
,
67 lang_reloc_statement_enum
,
68 lang_target_statement_enum
,
69 lang_output_statement_enum
,
70 lang_padding_statement_enum
,
72 lang_afile_asection_pair_statement_enum
,
73 lang_constructors_statement_enum
75 } lang_statement_header_type
;
80 lang_statement_header_type header
;
81 union etree_union
*exp
;
82 } lang_assignment_statement_type
;
85 typedef struct lang_target_statement_struct
87 lang_statement_header_type header
;
89 } lang_target_statement_type
;
92 typedef struct lang_output_statement_struct
94 lang_statement_header_type header
;
96 } lang_output_statement_type
;
99 typedef struct lang_output_section_statement_struct
101 lang_statement_header_type header
;
102 union etree_union
*addr_tree
;
103 lang_statement_list_type children
;
105 union lang_statement_union
*next
;
110 asection
*bfd_section
;
111 int flags
; /* Or together of all input sections */
112 int loadable
; /* set from NOLOAD flag in script */
113 struct memory_region_struct
*region
;
117 int subsection_alignment
; /* alignment of components */
118 int section_alignment
; /* alignment of start of section */
120 union etree_union
*load_base
;
121 } lang_output_section_statement_type
;
126 lang_statement_header_type header
;
127 } lang_common_statement_type
;
131 lang_statement_header_type header
;
132 } lang_object_symbols_statement_type
;
136 lang_statement_header_type header
;
139 asection
*output_section
;
140 } lang_fill_statement_type
;
144 lang_statement_header_type header
;
146 union etree_union
*exp
;
148 asection
*output_section
;
150 } lang_data_statement_type
;
152 /* Generate a reloc in the output file. */
156 lang_statement_header_type header
;
158 /* Reloc to generate. */
159 bfd_reloc_code_real_type reloc
;
161 /* Reloc howto structure. */
162 const reloc_howto_type
*howto
;
164 /* Section to generate reloc against. Exactly one of section and
165 name must be NULL. */
168 /* Name of symbol to generate reloc against. Exactly one of section
169 and name must be NULL. */
172 /* Expression for addend. */
173 union etree_union
*addend_exp
;
175 /* Resolved addend. */
176 bfd_vma addend_value
;
178 /* Output section where reloc should be performed. */
179 asection
*output_section
;
181 /* VMA within output section. */
183 } lang_reloc_statement_type
;
185 typedef struct lang_input_statement_struct
187 lang_statement_header_type header
;
188 /* Name of this file. */
189 const char *filename
;
190 /* Name to use for the symbol giving address of text start */
191 /* Usually the same as filename, but for a file spec'd with -l
192 this is the -l switch itself rather than the filename. */
193 const char *local_sym_name
;
198 file_ptr passive_position
;
200 /* Symbol table of the file. */
202 unsigned int symbol_count
;
204 /* Point to the next file - whatever it is, wanders up and down
207 union lang_statement_union
*next
;
208 /* Point to the next file, but skips archive contents */
209 union lang_statement_union
*next_real_file
;
213 /* 1 means search a set of directories for this file. */
214 boolean search_dirs_flag
;
216 /* 1 means this is base file of incremental load.
217 Do not load this file's text or data.
218 Also default text_start to after this file's bss. */
220 boolean just_syms_flag
;
225 /* unsigned int globals_in_this_file;*/
228 asection
*common_section
;
229 asection
*common_output_section
;
231 } lang_input_statement_type
;
235 lang_statement_header_type header
;
237 lang_input_statement_type
*ifile
;
239 } lang_input_section_type
;
244 lang_statement_header_type header
;
246 union lang_statement_union
*file
;
247 } lang_afile_asection_pair_statement_type
;
249 typedef struct lang_wild_statement_struct
251 lang_statement_header_type header
;
252 const char *section_name
;
253 const char *filename
;
254 lang_statement_list_type children
;
255 } lang_wild_statement_type
;
257 typedef struct lang_address_statement_struct
259 lang_statement_header_type header
;
260 const char *section_name
;
261 union etree_union
*address
;
262 } lang_address_statement_type
;
266 lang_statement_header_type header
;
267 bfd_vma output_offset
;
269 asection
*output_section
;
271 } lang_padding_statement_type
;
273 typedef union lang_statement_union
275 lang_statement_header_type header
;
276 union lang_statement_union
*next
;
277 lang_wild_statement_type wild_statement
;
278 lang_data_statement_type data_statement
;
279 lang_reloc_statement_type reloc_statement
;
280 lang_address_statement_type address_statement
;
281 lang_output_section_statement_type output_section_statement
;
282 lang_afile_asection_pair_statement_type afile_asection_pair_statement
;
283 lang_assignment_statement_type assignment_statement
;
284 lang_input_statement_type input_statement
;
285 lang_target_statement_type target_statement
;
286 lang_output_statement_type output_statement
;
287 lang_input_section_type input_section
;
288 lang_common_statement_type common_statement
;
289 lang_object_symbols_statement_type object_symbols_statement
;
290 lang_fill_statement_type fill_statement
;
291 lang_padding_statement_type padding_statement
;
292 } lang_statement_union_type
;
294 extern lang_output_section_statement_type
*abs_output_section
;
295 extern boolean lang_has_input_file
;
296 extern etree_type
*base
;
297 extern lang_statement_list_type
*stat_ptr
;
298 extern boolean delete_output_file_on_failure
;
300 extern void lang_init
PARAMS ((void));
301 extern struct memory_region_struct
*lang_memory_region_lookup
302 PARAMS ((const char *const));
303 extern void lang_map
PARAMS ((void));
304 extern void lang_set_flags
PARAMS ((int *, const char *));
305 extern void lang_add_output
PARAMS ((const char *, int from_script
));
306 extern void lang_enter_output_section_statement
307 PARAMS ((const char *output_section_statement_name
,
308 etree_type
* address_exp
,
312 etree_type
*subalign
,
314 extern void lang_final
PARAMS ((void));
315 extern void lang_process
PARAMS ((void));
316 extern void lang_section_start
PARAMS ((const char *, union etree_union
*));
317 extern void lang_add_entry
PARAMS ((const char *, int));
318 extern void lang_add_target
PARAMS ((const char *));
319 extern void lang_add_wild
PARAMS ((const char *const , const char *const));
320 extern void lang_add_map
PARAMS ((const char *));
321 extern void lang_add_fill
PARAMS ((int));
322 extern void lang_add_assignment
PARAMS ((union etree_union
*));
323 extern void lang_add_attribute
PARAMS ((enum statement_enum
));
324 extern void lang_startup
PARAMS ((const char *));
325 extern void lang_float
PARAMS ((enum bfd_boolean
));
326 extern void lang_leave_output_section_statement
PARAMS ((bfd_vma
,
328 extern void lang_abs_symbol_at_end_of
PARAMS ((const char *, const char *));
329 extern void lang_abs_symbol_at_beginning_of
PARAMS ((const char *,
331 extern void lang_statement_append
PARAMS ((struct statement_list
*,
332 union lang_statement_union
*,
333 union lang_statement_union
**));
334 extern void lang_for_each_file
335 PARAMS ((void (*dothis
) (lang_input_statement_type
*)));
337 #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
338 extern lang_statement_list_type file_chain; \
339 lang_input_statement_type *statement; \
340 for (statement = (lang_input_statement_type *)file_chain.head;\
341 statement != (lang_input_statement_type *)NULL; \
342 statement = (lang_input_statement_type *)statement->next)\
344 extern void lang_process
PARAMS ((void));
345 extern void ldlang_add_file
PARAMS ((lang_input_statement_type
*));
346 extern lang_output_section_statement_type
*lang_output_section_find
347 PARAMS ((const char * const));
348 extern lang_input_statement_type
*lang_add_input_file
349 PARAMS ((const char *name
, lang_input_file_enum_type file_type
,
350 const char *target
));
351 extern void lang_add_keepsyms_file
PARAMS ((const char *filename
));
352 extern lang_output_section_statement_type
*
353 lang_output_section_statement_lookup
PARAMS ((const char * const name
));
354 extern void ldlang_add_undef
PARAMS ((const char *const name
));
355 extern void lang_add_output_format
PARAMS ((const char *, int from_script
));
356 extern void lang_list_init
PARAMS ((lang_statement_list_type
*));
357 extern void lang_add_data
PARAMS ((int type
, union etree_union
*));
358 extern void lang_add_reloc
359 PARAMS ((bfd_reloc_code_real_type reloc
, const reloc_howto_type
*howto
,
360 asection
*section
, const char *name
, union etree_union
*addend
));
361 extern void lang_for_each_statement
362 PARAMS ((void (*func
) (lang_statement_union_type
*)));
363 extern PTR stat_alloc
PARAMS ((size_t size
));
364 extern bfd_vma lang_size_sections
365 PARAMS ((lang_statement_union_type
*s
,
366 lang_output_section_statement_type
*output_section_statement
,
367 lang_statement_union_type
**prev
, fill_type fill
,
368 bfd_vma dot
, boolean relax
));