3 Copyright (C) 1991 Free Software Foundation, Inc.
5 This file is part of GLD, the Gnu Linker.
7 GLD is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 1, or (at your option)
12 GLD is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GLD; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23 lang_input_file_is_l_enum
,
24 lang_input_file_is_symbols_only_enum
,
25 lang_input_file_is_marker_enum
,
26 lang_input_file_is_fake_enum
,
27 lang_input_file_is_search_file_enum
,
28 lang_input_file_is_file_enum
} lang_input_file_enum_type
;
30 typedef unsigned short fill_type
;
31 typedef struct statement_list
{
32 union lang_statement_union
*head
;
33 union lang_statement_union
**tail
;
34 } lang_statement_list_type
;
39 typedef struct memory_region_struct
{
41 struct memory_region_struct
*next
;
46 } lang_memory_region_type
;
48 typedef struct lang_statement_header_struct
50 union lang_statement_union
*next
;
52 lang_output_section_statement_enum
,
53 lang_assignment_statement_enum
,
54 lang_input_statement_enum
,
55 lang_address_statement_enum
,
56 lang_wild_statement_enum
,
57 lang_input_section_enum
,
58 lang_object_symbols_statement_enum
,
59 lang_fill_statement_enum
,
60 lang_data_statement_enum
,
61 lang_target_statement_enum
,
62 lang_output_statement_enum
,
63 lang_padding_statement_enum
,
65 lang_afile_asection_pair_statement_enum
,
66 lang_constructors_statement_enum
69 } lang_statement_header_type
;
74 lang_statement_header_type header
;
75 union etree_union
*exp
;
76 } lang_assignment_statement_type
;
79 typedef struct lang_target_statement_struct
{
80 lang_statement_header_type header
;
82 } lang_target_statement_type
;
85 typedef struct lang_output_statement_struct
{
86 lang_statement_header_type header
;
88 } lang_output_statement_type
;
91 typedef struct lang_output_section_statement_struct
93 lang_statement_header_type header
;
94 union etree_union
*addr_tree
;
95 lang_statement_list_type children
;
97 union lang_statement_union
*next
;
99 unsigned long subsection_alignment
;
102 asection
*bfd_section
;
104 struct memory_region_struct
*region
;
107 } lang_output_section_statement_type
;
111 lang_statement_header_type header
;
112 } lang_common_statement_type
;
115 lang_statement_header_type header
;
116 } lang_object_symbols_statement_type
;
119 lang_statement_header_type header
;
121 } lang_fill_statement_type
;
124 lang_statement_header_type header
;
126 union etree_union
*exp
;
128 asection
*output_section
;
130 } lang_data_statement_type
;
135 typedef struct lang_input_statement_struct
137 lang_statement_header_type header
;
138 /* Name of this file. */
139 CONST
char *filename
;
140 /* Name to use for the symbol giving address of text start */
141 /* Usually the same as filename, but for a file spec'd with -l
142 this is the -l switch itself rather than the filename. */
143 CONST
char *local_sym_name
;
148 file_ptr passive_position
;
150 /* Symbol table of the file. */
152 unsigned int symbol_count
;
154 /* For library members only */
156 /* For a library, points to chain of entries for the library members. */
157 struct lang_input_statement_struct
*subfiles
;
158 /* For a library member, offset of the member within the archive.
159 Zero for files that are not library members. */
160 /* int starting_offset;*/
161 /* Size of contents of this file, if library member. */
162 bfd_size_type total_size
;
163 /* For library member, points to the library's own entry. */
164 struct lang_input_statement_struct
*superfile
;
165 /* For library member, points to next entry for next member. */
166 struct lang_input_statement_struct
*chain
;
167 /* Point to the next file - whatever it is, wanders up and down
170 union lang_statement_union
*next
;
171 /* Point to the next file, but skips archive contents */
172 union lang_statement_union
*next_real_file
;
176 /* 1 means search a set of directories for this file. */
177 boolean search_dirs_flag
;
179 /* 1 means this is base file of incremental load.
180 Do not load this file's text or data.
181 Also default text_start to after this file's bss. */
183 boolean just_syms_flag
;
188 /* unsigned int globals_in_this_file;*/
192 asection
*common_section
;
193 asection
*common_output_section
;
194 } lang_input_statement_type
;
197 lang_statement_header_type header
;
199 lang_input_statement_type
*ifile
;
201 } lang_input_section_type
;
205 lang_statement_header_type header
;
207 union lang_statement_union
*file
;
208 } lang_afile_asection_pair_statement_type
;
210 typedef struct lang_wild_statement_struct
{
211 lang_statement_header_type header
;
212 CONST
char *section_name
;
213 CONST
char *filename
;
214 lang_statement_list_type children
;
215 } lang_wild_statement_type
;
217 typedef struct lang_address_statement_struct
{
218 lang_statement_header_type header
;
219 CONST
char *section_name
;
220 union etree_union
*address
;
221 } lang_address_statement_type
;
224 lang_statement_header_type header
;
225 bfd_vma output_offset
;
227 asection
*output_section
;
229 } lang_padding_statement_type
;
231 typedef union lang_statement_union
233 lang_statement_header_type header
;
234 union lang_statement_union
*next
;
235 lang_wild_statement_type wild_statement
;
236 lang_data_statement_type data_statement
;
237 lang_address_statement_type address_statement
;
238 lang_output_section_statement_type output_section_statement
;
239 lang_afile_asection_pair_statement_type afile_asection_pair_statement
;
240 lang_assignment_statement_type assignment_statement
;
241 lang_input_statement_type input_statement
;
242 lang_target_statement_type target_statement
;
243 lang_output_statement_type output_statement
;
244 lang_input_section_type input_section
;
245 lang_common_statement_type common_statement
;
246 lang_object_symbols_statement_type object_symbols_statement
;
247 lang_fill_statement_type fill_statement
;
248 lang_padding_statement_type padding_statement
;
249 } lang_statement_union_type
;
253 PROTO(void,lang_init
,(void));
254 PROTO(struct memory_region_struct
,
255 *lang_memory_region_lookup
,(CONST
259 PROTO(void ,lang_map
,(FILE *));
260 PROTO(void,lang_set_flags
,(int *, CONST
char *));
261 PROTO(void,lang_add_output
,(CONST
char *));
263 PROTO(void,lang_final
,(void));
264 PROTO(struct symbol_cache_entry
*,create_symbol
,(CONST
char *, unsigned int, struct sec
*));
265 PROTO(void ,lang_process
,(void));
266 PROTO(void ,lang_section_start
,(CONST
char *, union etree_union
*));
267 PROTO(void,lang_add_entry
,(CONST
char *));
268 PROTO(void,lang_add_target
,(CONST
char *));
269 PROTO(void,lang_add_wild
,(CONST
char *CONST
, CONST
char *CONST
));
270 PROTO(void,lang_add_map
,(CONST
char *));
271 PROTO(void,lang_add_fill
,(int));
272 PROTO(void,lang_add_assignment
,(union etree_union
*));
273 PROTO(void,lang_add_attribute
,(enum statement_enum
));
274 PROTO(void,lang_startup
,(CONST
char *));
275 PROTO(void,lang_float
,(enum bfd_boolean
));
276 PROTO(void,lang_leave_output_section_statement
,(bfd_vma
, CONST
char *));
277 PROTO(void,lang_abs_symbol_at_end_of
,(CONST
char *, CONST
char *));
278 PROTO(void,lang_abs_symbol_at_beginning_of
,(CONST
char *, CONST
char *));
279 PROTO(void,lang_statement_append
,(struct statement_list
*, union lang_statement_union
*, union lang_statement_union
**));
280 PROTO(void, lang_for_each_file
,(void (*dothis
)(lang_input_statement_type
*)));
283 #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
284 extern lang_statement_list_type file_chain; \
285 lang_input_statement_type *statement; \
286 for (statement = (lang_input_statement_type *)file_chain.head;\
287 statement != (lang_input_statement_type *)NULL; \
288 statement = (lang_input_statement_type *)statement->next)\
290 #define LANG_FOR_EACH_INPUT_SECTION(statement, abfd, section, x) \
291 { extern lang_statement_list_type file_chain; \
292 lang_input_statement_type *statement; \
293 for (statement = (lang_input_statement_type *)file_chain.head;\
294 statement != (lang_input_statement_type *)NULL; \
295 statement = (lang_input_statement_type *)statement->next)\
298 bfd *abfd = statement->the_bfd; \
299 for (section = abfd->sections; \
300 section != (asection *)NULL; \
301 section = section->next) { \
307 #define LANG_FOR_EACH_OUTPUT_SECTION(section, x) \
308 { extern bfd *output_bfd; \
310 for (section = output_bfd->sections; \
311 section != (asection *)NULL; \
312 section = section->next) \
317 PROTO(void, lang_process
,(void));
318 PROTO(void, ldlang_add_file
,(lang_input_statement_type
*));
320 PROTO(lang_output_section_statement_type
321 *,lang_output_section_find
,(CONST
char * CONST
));
323 PROTO(lang_input_statement_type
*,
324 lang_add_input_file
,(char *name
,
325 lang_input_file_enum_type file_type
,
327 PROTO(lang_output_section_statement_type
*,
328 lang_output_section_statement_lookup
,(CONST
char * CONST name
));
330 PROTO(void, ldlang_add_undef
,(CONST
char *CONST name
));
331 PROTO(void, lang_add_output_format
,(CONST
char *));
334 void EXFUN(lang_list_init
,( lang_statement_list_type
*));
336 void EXFUN(lang_add_data
,(int type
, union etree_union
*));