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
;
40 boolean flag_executable
;
41 boolean flag_loadable
;
42 } lang_section_flags_type
;
44 typedef struct memory_region_struct
{
46 struct memory_region_struct
*next
;
50 lang_section_flags_type flags
;
51 } lang_memory_region_type
;
53 typedef struct lang_statement_header_struct
55 union lang_statement_union
*next
;
57 lang_output_section_statement_enum
,
58 lang_assignment_statement_enum
,
59 lang_input_statement_enum
,
60 lang_address_statement_enum
,
61 lang_wild_statement_enum
,
62 lang_input_section_enum
,
63 lang_object_symbols_statement_enum
,
64 lang_fill_statement_enum
,
65 lang_data_statement_enum
,
66 lang_target_statement_enum
,
67 lang_output_statement_enum
,
68 lang_padding_statement_enum
,
70 lang_afile_asection_pair_statement_enum
73 } lang_statement_header_type
;
78 lang_statement_header_type header
;
79 union etree_union
*exp
;
80 } lang_assignment_statement_type
;
83 typedef struct lang_target_statement_struct
{
84 lang_statement_header_type header
;
86 } lang_target_statement_type
;
89 typedef struct lang_output_statement_struct
{
90 lang_statement_header_type header
;
92 } lang_output_statement_type
;
95 typedef struct lang_output_section_statement_struct
97 lang_statement_header_type header
;
98 union etree_union
*addr_tree
;
99 lang_statement_list_type children
;
101 union lang_statement_union
*next
;
103 unsigned long subsection_alignment
;
106 asection
*bfd_section
;
107 lang_section_flags_type flags
;
108 struct memory_region_struct
*region
;
111 } lang_output_section_statement_type
;
115 lang_statement_header_type header
;
116 } lang_common_statement_type
;
119 lang_statement_header_type header
;
120 } lang_object_symbols_statement_type
;
123 lang_statement_header_type header
;
125 } lang_fill_statement_type
;
128 lang_statement_header_type header
;
130 union etree_union
*exp
;
132 asection
*output_section
;
134 } lang_data_statement_type
;
139 typedef struct lang_input_statement_struct
141 lang_statement_header_type header
;
142 /* Name of this file. */
143 CONST
char *filename
;
144 /* Name to use for the symbol giving address of text start */
145 /* Usually the same as filename, but for a file spec'd with -l
146 this is the -l switch itself rather than the filename. */
147 CONST
char *local_sym_name
;
149 /* Describe the layout of the contents of the file */
151 /* The file's a.out header. */
152 /* struct exec header;*/
153 /* Offset in file of GDB symbol segment, or 0 if there is none. */
156 /* Describe data from the file loaded into core */
161 file_ptr passive_position
;
163 /* Symbol table of the file. */
165 unsigned int symbol_count
;
167 /* For library members only */
169 /* For a library, points to chain of entries for the library members. */
170 struct lang_input_statement_struct
*subfiles
;
171 /* For a library member, offset of the member within the archive.
172 Zero for files that are not library members. */
173 /* int starting_offset;*/
174 /* Size of contents of this file, if library member. */
176 /* For library member, points to the library's own entry. */
177 struct lang_input_statement_struct
*superfile
;
178 /* For library member, points to next entry for next member. */
179 struct lang_input_statement_struct
*chain
;
180 /* Point to the next file - whatever it is, wanders up and down
183 union lang_statement_union
*next
;
184 /* Point to the next file, but skips archive contents */
185 union lang_statement_union
*next_real_file
;
189 /* 1 means search a set of directories for this file. */
190 boolean search_dirs_flag
;
192 /* 1 means this is base file of incremental load.
193 Do not load this file's text or data.
194 Also default text_start to after this file's bss. */
196 boolean just_syms_flag
;
201 /* unsigned int globals_in_this_file;*/
205 asection
*common_section
;
206 asection
*common_output_section
;
207 } lang_input_statement_type
;
210 lang_statement_header_type header
;
212 lang_input_statement_type
*ifile
;
214 } lang_input_section_type
;
218 lang_statement_header_type header
;
220 union lang_statement_union
*file
;
221 } lang_afile_asection_pair_statement_type
;
223 typedef struct lang_wild_statement_struct
{
224 lang_statement_header_type header
;
225 CONST
char *section_name
;
226 CONST
char *filename
;
227 lang_statement_list_type children
;
228 } lang_wild_statement_type
;
230 typedef struct lang_address_statement_struct
{
231 lang_statement_header_type header
;
232 CONST
char *section_name
;
233 union etree_union
*address
;
234 } lang_address_statement_type
;
237 lang_statement_header_type header
;
238 bfd_vma output_offset
;
240 asection
*output_section
;
242 } lang_padding_statement_type
;
244 typedef union lang_statement_union
246 lang_statement_header_type header
;
247 union lang_statement_union
*next
;
248 lang_wild_statement_type wild_statement
;
249 lang_data_statement_type data_statement
;
250 lang_address_statement_type address_statement
;
251 lang_output_section_statement_type output_section_statement
;
252 lang_afile_asection_pair_statement_type afile_asection_pair_statement
;
253 lang_assignment_statement_type assignment_statement
;
254 lang_input_statement_type input_statement
;
255 lang_target_statement_type target_statement
;
256 lang_output_statement_type output_statement
;
257 lang_input_section_type input_section
;
258 lang_common_statement_type common_statement
;
259 lang_object_symbols_statement_type object_symbols_statement
;
260 lang_fill_statement_type fill_statement
;
261 lang_padding_statement_type padding_statement
;
262 } lang_statement_union_type
;
266 PROTO(void,lang_init
,(void));
267 PROTO(struct memory_region_struct
,
268 *lang_memory_region_lookup
,(CONST
272 PROTO(void ,lang_map
,(FILE *));
273 PROTO(void,lang_set_flags
,(lang_section_flags_type
*, CONST
char *));
274 PROTO(void,lang_add_output
,(CONST
char *));
276 PROTO(void,lang_final
,(void));
277 PROTO(struct symbol_cache_entry
*,create_symbol
,(CONST
char *, unsigned int, struct sec
*));
278 PROTO(void ,lang_process
,(void));
279 PROTO(void ,lang_section_start
,(CONST
char *, union etree_union
*));
280 PROTO(void,lang_add_entry
,(CONST
char *));
281 PROTO(void,lang_add_target
,(CONST
char *));
282 PROTO(void,lang_add_wild
,(CONST
char *CONST
, CONST
char *CONST
));
283 PROTO(void,lang_add_map
,(CONST
char *));
284 PROTO(void,lang_add_fill
,(int));
285 PROTO(void,lang_add_assignment
,(union etree_union
*));
286 PROTO(void,lang_add_attribute
,(enum statement_enum
));
287 PROTO(void,lang_startup
,(CONST
char *));
288 PROTO(void,lang_float
,(enum boolean
));
289 PROTO(void,lang_leave_output_section_statement
,(bfd_vma
, CONST
char *));
290 PROTO(void,lang_abs_symbol_at_end_of
,(CONST
char *, CONST
char *));
291 PROTO(void,lang_abs_symbol_at_beginning_of
,(CONST
char *, CONST
char *));
292 PROTO(void,lang_statement_append
,(struct statement_list
*, union lang_statement_union
*, union lang_statement_union
**));
293 PROTO(void, lang_for_each_file
,(void (*dothis
)(lang_input_statement_type
*)));
296 #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
297 extern lang_statement_list_type file_chain; \
298 lang_input_statement_type *statement; \
299 for (statement = (lang_input_statement_type *)file_chain.head;\
300 statement != (lang_input_statement_type *)NULL; \
301 statement = (lang_input_statement_type *)statement->next)\
303 #define LANG_FOR_EACH_INPUT_SECTION(statement, abfd, section, x) \
304 { extern lang_statement_list_type file_chain; \
305 lang_input_statement_type *statement; \
306 for (statement = (lang_input_statement_type *)file_chain.head;\
307 statement != (lang_input_statement_type *)NULL; \
308 statement = (lang_input_statement_type *)statement->next)\
311 bfd *abfd = statement->the_bfd; \
312 for (section = abfd->sections; \
313 section != (asection *)NULL; \
314 section = section->next) { \
320 #define LANG_FOR_EACH_OUTPUT_SECTION(section, x) \
321 { extern bfd *output_bfd; \
323 for (section = output_bfd->sections; \
324 section != (asection *)NULL; \
325 section = section->next) \
330 PROTO(void, lang_process
,(void));
331 PROTO(void, ldlang_add_file
,(lang_input_statement_type
*));
333 PROTO(lang_output_section_statement_type
334 *,lang_output_section_find
,(CONST
char * CONST
));
336 PROTO(lang_input_statement_type
*,
337 lang_add_input_file
,(char *name
,
338 lang_input_file_enum_type file_type
,
340 PROTO(lang_output_section_statement_type
*,
341 lang_output_section_statement_lookup
,(CONST
char * CONST name
));
343 PROTO(void, ldlang_add_undef
,(CONST
char *CONST name
));
344 PROTO(void, lang_add_output_format
,(CONST
char *));