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 short 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_target_statement_enum
,
68 lang_output_statement_enum
,
69 lang_padding_statement_enum
,
71 lang_afile_asection_pair_statement_enum
,
72 lang_constructors_statement_enum
74 } lang_statement_header_type
;
79 lang_statement_header_type header
;
80 union etree_union
*exp
;
81 } lang_assignment_statement_type
;
84 typedef struct lang_target_statement_struct
86 lang_statement_header_type header
;
88 } lang_target_statement_type
;
91 typedef struct lang_output_statement_struct
93 lang_statement_header_type header
;
95 } lang_output_statement_type
;
98 typedef struct lang_output_section_statement_struct
100 lang_statement_header_type header
;
101 union etree_union
*addr_tree
;
102 lang_statement_list_type children
;
104 union lang_statement_union
*next
;
109 asection
*bfd_section
;
110 int flags
; /* Or together of all input sections */
111 int loadable
; /* set from NOLOAD flag in script */
112 struct memory_region_struct
*region
;
116 int subsection_alignment
; /* alignment of components */
117 int section_alignment
; /* alignment of start of section */
119 union etree_union
*load_base
;
120 } lang_output_section_statement_type
;
125 lang_statement_header_type header
;
126 } lang_common_statement_type
;
130 lang_statement_header_type header
;
131 } lang_object_symbols_statement_type
;
135 lang_statement_header_type header
;
138 asection
*output_section
;
139 } lang_fill_statement_type
;
143 lang_statement_header_type header
;
145 union etree_union
*exp
;
147 asection
*output_section
;
149 } lang_data_statement_type
;
154 typedef struct lang_input_statement_struct
156 lang_statement_header_type header
;
157 /* Name of this file. */
158 const char *filename
;
159 /* Name to use for the symbol giving address of text start */
160 /* Usually the same as filename, but for a file spec'd with -l
161 this is the -l switch itself rather than the filename. */
162 const char *local_sym_name
;
167 file_ptr passive_position
;
169 /* Symbol table of the file. */
171 unsigned int symbol_count
;
173 /* For library members only */
175 /* For a library, points to chain of entries for the library members. */
176 struct lang_input_statement_struct
*subfiles
;
178 /* Size of contents of this file, if library member. */
179 bfd_size_type total_size
;
181 /* For library member, points to the library's own entry. */
182 struct lang_input_statement_struct
*superfile
;
184 /* For library member, points to next entry for next member. */
185 struct lang_input_statement_struct
*chain
;
187 /* Point to the next file - whatever it is, wanders up and down
190 union lang_statement_union
*next
;
191 /* Point to the next file, but skips archive contents */
192 union lang_statement_union
*next_real_file
;
196 /* 1 means search a set of directories for this file. */
197 boolean search_dirs_flag
;
199 /* 1 means this is base file of incremental load.
200 Do not load this file's text or data.
201 Also default text_start to after this file's bss. */
203 boolean just_syms_flag
;
208 /* unsigned int globals_in_this_file;*/
211 asection
*common_section
;
212 asection
*common_output_section
;
214 } lang_input_statement_type
;
218 lang_statement_header_type header
;
220 lang_input_statement_type
*ifile
;
222 } lang_input_section_type
;
227 lang_statement_header_type header
;
229 union lang_statement_union
*file
;
230 } lang_afile_asection_pair_statement_type
;
232 typedef struct lang_wild_statement_struct
234 lang_statement_header_type header
;
235 const char *section_name
;
236 const char *filename
;
237 lang_statement_list_type children
;
238 } lang_wild_statement_type
;
240 typedef struct lang_address_statement_struct
242 lang_statement_header_type header
;
243 const char *section_name
;
244 union etree_union
*address
;
245 } lang_address_statement_type
;
249 lang_statement_header_type header
;
250 bfd_vma output_offset
;
252 asection
*output_section
;
254 } lang_padding_statement_type
;
256 typedef union lang_statement_union
258 lang_statement_header_type header
;
259 union lang_statement_union
*next
;
260 lang_wild_statement_type wild_statement
;
261 lang_data_statement_type data_statement
;
262 lang_address_statement_type address_statement
;
263 lang_output_section_statement_type output_section_statement
;
264 lang_afile_asection_pair_statement_type afile_asection_pair_statement
;
265 lang_assignment_statement_type assignment_statement
;
266 lang_input_statement_type input_statement
;
267 lang_target_statement_type target_statement
;
268 lang_output_statement_type output_statement
;
269 lang_input_section_type input_section
;
270 lang_common_statement_type common_statement
;
271 lang_object_symbols_statement_type object_symbols_statement
;
272 lang_fill_statement_type fill_statement
;
273 lang_padding_statement_type padding_statement
;
274 } lang_statement_union_type
;
276 extern bfd_size_type largest_section
;
277 extern lang_output_section_statement_type
*abs_output_section
;
278 extern lang_input_statement_type
*script_file
;
279 extern boolean lang_has_input_file
;
280 extern boolean relaxing
;
281 extern etree_type
*base
;
282 extern lang_statement_list_type
*stat_ptr
;
283 extern boolean delete_output_file_on_failure
;
284 extern lang_output_section_statement_type
*create_object_symbols
;
286 extern void lang_init
PARAMS ((void));
287 extern struct memory_region_struct
*lang_memory_region_lookup
288 PARAMS ((const char *const));
289 extern void lang_map
PARAMS ((void));
290 extern void lang_set_flags
PARAMS ((int *, const char *));
291 extern void lang_add_output
PARAMS ((const char *, int from_script
));
292 extern void lang_enter_output_section_statement
293 PARAMS ((const char *output_section_statement_name
,
294 etree_type
* address_exp
,
298 etree_type
*subalign
,
300 extern void lang_final
PARAMS ((void));
301 extern struct symbol_cache_entry
*create_symbol
302 PARAMS ((const char *, unsigned int, struct sec
*));
303 extern void lang_process
PARAMS ((void));
304 extern void lang_section_start
PARAMS ((const char *, union etree_union
*));
305 extern void lang_add_entry
PARAMS ((const char *));
306 extern void lang_add_target
PARAMS ((const char *));
307 extern void lang_add_wild
PARAMS ((const char *const , const char *const));
308 extern void lang_add_map
PARAMS ((const char *));
309 extern void lang_add_fill
PARAMS ((int));
310 extern void lang_add_assignment
PARAMS ((union etree_union
*));
311 extern void lang_add_attribute
PARAMS ((enum statement_enum
));
312 extern void lang_startup
PARAMS ((const char *));
313 extern void lang_float
PARAMS ((enum bfd_boolean
));
314 extern void lang_leave_output_section_statement
PARAMS ((bfd_vma
,
316 extern void lang_abs_symbol_at_end_of
PARAMS ((const char *, const char *));
317 extern void lang_abs_symbol_at_beginning_of
PARAMS ((const char *,
319 extern void lang_statement_append
PARAMS ((struct statement_list
*,
320 union lang_statement_union
*,
321 union lang_statement_union
**));
322 extern void lang_for_each_file
323 PARAMS ((void (*dothis
) (lang_input_statement_type
*)));
325 #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
326 extern lang_statement_list_type file_chain; \
327 lang_input_statement_type *statement; \
328 for (statement = (lang_input_statement_type *)file_chain.head;\
329 statement != (lang_input_statement_type *)NULL; \
330 statement = (lang_input_statement_type *)statement->next)\
332 #define LANG_FOR_EACH_INPUT_SECTION(statement, abfd, section, x) \
334 extern lang_statement_list_type file_chain; \
335 lang_input_statement_type *statement; \
336 for (statement = (lang_input_statement_type *)file_chain.head; \
337 statement != (lang_input_statement_type *)NULL; \
338 statement = (lang_input_statement_type *)statement->next) \
341 bfd *abfd = statement->the_bfd; \
342 for (section = abfd->sections; \
343 section != (asection *)NULL; \
344 section = section->next) \
351 #define LANG_FOR_EACH_OUTPUT_SECTION(section, x) \
353 extern bfd *output_bfd; \
355 for (section = output_bfd->sections; \
356 section != (asection *)NULL; \
357 section = section->next) \
363 extern void lang_process
PARAMS ((void));
364 extern void ldlang_add_file
PARAMS ((lang_input_statement_type
*));
365 extern lang_output_section_statement_type
*lang_output_section_find
366 PARAMS ((const char * const));
367 extern lang_input_statement_type
*lang_add_input_file
368 PARAMS ((const char *name
, lang_input_file_enum_type file_type
,
369 const char *target
));
370 extern void lang_add_keepsyms_file
PARAMS ((const char *filename
));
371 extern lang_output_section_statement_type
*
372 lang_output_section_statement_lookup
PARAMS ((const char * const name
));
373 extern void ldlang_add_undef
PARAMS ((const char *const name
));
374 extern void lang_add_output_format
PARAMS ((const char *, int from_script
));
375 extern void lang_list_init
PARAMS ((lang_statement_list_type
*));
376 extern void lang_add_data
PARAMS ((int type
, union etree_union
*));
377 extern void lang_for_each_statement
PARAMS ((void (*func
)()));
378 extern PTR stat_alloc
PARAMS ((size_t size
));