1 /* ldlang.h - linker command language support
2 Copyright 1991, 1992, 1993, 1994, 1995 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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
,
71 lang_group_statement_enum
,
73 lang_afile_asection_pair_statement_enum
,
74 lang_constructors_statement_enum
76 } lang_statement_header_type
;
81 lang_statement_header_type header
;
82 union etree_union
*exp
;
83 } lang_assignment_statement_type
;
86 typedef struct lang_target_statement_struct
88 lang_statement_header_type header
;
90 } lang_target_statement_type
;
93 typedef struct lang_output_statement_struct
95 lang_statement_header_type header
;
97 } lang_output_statement_type
;
100 typedef struct lang_output_section_statement_struct
102 lang_statement_header_type header
;
103 union etree_union
*addr_tree
;
104 lang_statement_list_type children
;
106 union lang_statement_union
*next
;
111 asection
*bfd_section
;
112 int flags
; /* Or together of all input sections */
113 int loadable
; /* set from NOLOAD flag in script */
114 struct memory_region_struct
*region
;
118 int subsection_alignment
; /* alignment of components */
119 int section_alignment
; /* alignment of start of section */
121 union etree_union
*load_base
;
122 } lang_output_section_statement_type
;
127 lang_statement_header_type header
;
128 } lang_common_statement_type
;
132 lang_statement_header_type header
;
133 } lang_object_symbols_statement_type
;
137 lang_statement_header_type header
;
140 asection
*output_section
;
141 } lang_fill_statement_type
;
145 lang_statement_header_type header
;
147 union etree_union
*exp
;
149 asection
*output_section
;
151 } lang_data_statement_type
;
153 /* Generate a reloc in the output file. */
157 lang_statement_header_type header
;
159 /* Reloc to generate. */
160 bfd_reloc_code_real_type reloc
;
162 /* Reloc howto structure. */
163 reloc_howto_type
*howto
;
165 /* Section to generate reloc against. Exactly one of section and
166 name must be NULL. */
169 /* Name of symbol to generate reloc against. Exactly one of section
170 and name must be NULL. */
173 /* Expression for addend. */
174 union etree_union
*addend_exp
;
176 /* Resolved addend. */
177 bfd_vma addend_value
;
179 /* Output section where reloc should be performed. */
180 asection
*output_section
;
182 /* VMA within output section. */
184 } lang_reloc_statement_type
;
186 typedef struct lang_input_statement_struct
188 lang_statement_header_type header
;
189 /* Name of this file. */
190 const char *filename
;
191 /* Name to use for the symbol giving address of text start */
192 /* Usually the same as filename, but for a file spec'd with -l
193 this is the -l switch itself rather than the filename. */
194 const char *local_sym_name
;
199 file_ptr passive_position
;
201 /* Symbol table of the file. */
203 unsigned int symbol_count
;
205 /* Point to the next file - whatever it is, wanders up and down
208 union lang_statement_union
*next
;
209 /* Point to the next file, but skips archive contents */
210 union lang_statement_union
*next_real_file
;
214 /* 1 means search a set of directories for this file. */
215 boolean search_dirs_flag
;
217 /* 1 means this is base file of incremental load.
218 Do not load this file's text or data.
219 Also default text_start to after this file's bss. */
221 boolean just_syms_flag
;
226 /* unsigned int globals_in_this_file;*/
229 asection
*common_section
;
230 asection
*common_output_section
;
232 } lang_input_statement_type
;
236 lang_statement_header_type header
;
238 lang_input_statement_type
*ifile
;
240 } lang_input_section_type
;
245 lang_statement_header_type header
;
247 union lang_statement_union
*file
;
248 } lang_afile_asection_pair_statement_type
;
250 typedef struct lang_wild_statement_struct
252 lang_statement_header_type header
;
253 const char *section_name
;
254 const char *filename
;
255 lang_statement_list_type children
;
256 } lang_wild_statement_type
;
258 typedef struct lang_address_statement_struct
260 lang_statement_header_type header
;
261 const char *section_name
;
262 union etree_union
*address
;
263 } lang_address_statement_type
;
267 lang_statement_header_type header
;
268 bfd_vma output_offset
;
270 asection
*output_section
;
272 } lang_padding_statement_type
;
274 /* A group statement collects a set of libraries together. The
275 libraries are searched multiple times, until no new undefined
276 symbols are found. The effect is to search a group of libraries as
277 though they were a single library. */
281 lang_statement_header_type header
;
282 lang_statement_list_type children
;
283 } lang_group_statement_type
;
285 typedef union lang_statement_union
287 lang_statement_header_type header
;
288 union lang_statement_union
*next
;
289 lang_wild_statement_type wild_statement
;
290 lang_data_statement_type data_statement
;
291 lang_reloc_statement_type reloc_statement
;
292 lang_address_statement_type address_statement
;
293 lang_output_section_statement_type output_section_statement
;
294 lang_afile_asection_pair_statement_type afile_asection_pair_statement
;
295 lang_assignment_statement_type assignment_statement
;
296 lang_input_statement_type input_statement
;
297 lang_target_statement_type target_statement
;
298 lang_output_statement_type output_statement
;
299 lang_input_section_type input_section
;
300 lang_common_statement_type common_statement
;
301 lang_object_symbols_statement_type object_symbols_statement
;
302 lang_fill_statement_type fill_statement
;
303 lang_padding_statement_type padding_statement
;
304 lang_group_statement_type group_statement
;
305 } lang_statement_union_type
;
307 extern lang_output_section_statement_type
*abs_output_section
;
308 extern boolean lang_has_input_file
;
309 extern etree_type
*base
;
310 extern lang_statement_list_type
*stat_ptr
;
311 extern boolean delete_output_file_on_failure
;
313 extern void lang_init
PARAMS ((void));
314 extern struct memory_region_struct
*lang_memory_region_lookup
315 PARAMS ((const char *const));
316 extern void lang_map
PARAMS ((void));
317 extern void lang_set_flags
PARAMS ((int *, const char *));
318 extern void lang_add_output
PARAMS ((const char *, int from_script
));
319 extern void lang_enter_output_section_statement
320 PARAMS ((const char *output_section_statement_name
,
321 etree_type
* address_exp
,
325 etree_type
*subalign
,
327 extern void lang_final
PARAMS ((void));
328 extern void lang_process
PARAMS ((void));
329 extern void lang_section_start
PARAMS ((const char *, union etree_union
*));
330 extern void lang_add_entry
PARAMS ((const char *, int));
331 extern void lang_add_target
PARAMS ((const char *));
332 extern void lang_add_wild
PARAMS ((const char *const , const char *const));
333 extern void lang_add_map
PARAMS ((const char *));
334 extern void lang_add_fill
PARAMS ((int));
335 extern void lang_add_assignment
PARAMS ((union etree_union
*));
336 extern void lang_add_attribute
PARAMS ((enum statement_enum
));
337 extern void lang_startup
PARAMS ((const char *));
338 extern void lang_float
PARAMS ((enum bfd_boolean
));
339 extern void lang_leave_output_section_statement
PARAMS ((bfd_vma
,
341 extern void lang_abs_symbol_at_end_of
PARAMS ((const char *, const char *));
342 extern void lang_abs_symbol_at_beginning_of
PARAMS ((const char *,
344 extern void lang_statement_append
PARAMS ((struct statement_list
*,
345 union lang_statement_union
*,
346 union lang_statement_union
**));
347 extern void lang_for_each_input_file
348 PARAMS ((void (*dothis
) (lang_input_statement_type
*)));
349 extern void lang_for_each_file
350 PARAMS ((void (*dothis
) (lang_input_statement_type
*)));
351 extern bfd_vma lang_do_assignments
352 PARAMS ((lang_statement_union_type
* s
,
353 lang_output_section_statement_type
*output_section_statement
,
357 #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
358 extern lang_statement_list_type file_chain; \
359 lang_input_statement_type *statement; \
360 for (statement = (lang_input_statement_type *)file_chain.head;\
361 statement != (lang_input_statement_type *)NULL; \
362 statement = (lang_input_statement_type *)statement->next)\
364 extern void lang_process
PARAMS ((void));
365 extern void ldlang_add_file
PARAMS ((lang_input_statement_type
*));
366 extern lang_output_section_statement_type
*lang_output_section_find
367 PARAMS ((const char * const));
368 extern lang_input_statement_type
*lang_add_input_file
369 PARAMS ((const char *name
, lang_input_file_enum_type file_type
,
370 const char *target
));
371 extern void lang_add_keepsyms_file
PARAMS ((const char *filename
));
372 extern lang_output_section_statement_type
*
373 lang_output_section_statement_lookup
PARAMS ((const char * const name
));
374 extern void ldlang_add_undef
PARAMS ((const char *const name
));
375 extern void lang_add_output_format
PARAMS ((const char *, const char *,
376 const char *, int from_script
));
377 extern void lang_list_init
PARAMS ((lang_statement_list_type
*));
378 extern void lang_add_data
PARAMS ((int type
, union etree_union
*));
379 extern void lang_add_reloc
380 PARAMS ((bfd_reloc_code_real_type reloc
, reloc_howto_type
*howto
,
381 asection
*section
, const char *name
, union etree_union
*addend
));
382 extern void lang_for_each_statement
383 PARAMS ((void (*func
) (lang_statement_union_type
*)));
384 extern PTR stat_alloc
PARAMS ((size_t size
));
385 extern bfd_vma lang_size_sections
386 PARAMS ((lang_statement_union_type
*s
,
387 lang_output_section_statement_type
*output_section_statement
,
388 lang_statement_union_type
**prev
, fill_type fill
,
389 bfd_vma dot
, boolean relax
));
390 extern void lang_enter_group
PARAMS ((void));
391 extern void lang_leave_group
PARAMS ((void));
392 extern void wild_doit
393 PARAMS ((lang_statement_list_type
*ptr
, asection
*section
,
394 lang_output_section_statement_type
*output
,
395 lang_input_statement_type
*file
));