added mri.c
[deliverable/binutils-gdb.git] / ld / ldlang.h
1 /* ldlang.h -
2
3 Copyright (C) 1991 Free Software Foundation, Inc.
4
5 This file is part of GLD, the Gnu Linker.
6
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)
10 any later version.
11
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.
16
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. */
20
21
22 typedef enum {
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;
29
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;
35
36
37
38
39 typedef struct memory_region_struct {
40 char *name;
41 struct memory_region_struct *next;
42 bfd_vma origin;
43 bfd_offset length;
44 bfd_vma current;
45 int flags;
46 } lang_memory_region_type ;
47
48 typedef struct lang_statement_header_struct
49 {
50 union lang_statement_union *next;
51 enum statement_enum {
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,
64
65 lang_afile_asection_pair_statement_enum,
66 lang_constructors_statement_enum
67 } type;
68
69 } lang_statement_header_type;
70
71
72 typedef struct
73 {
74 lang_statement_header_type header;
75 union etree_union *exp;
76 } lang_assignment_statement_type;
77
78
79 typedef struct lang_target_statement_struct {
80 lang_statement_header_type header;
81 CONST char *target;
82 } lang_target_statement_type;
83
84
85 typedef struct lang_output_statement_struct {
86 lang_statement_header_type header;
87 CONST char *name;
88 } lang_output_statement_type;
89
90
91 typedef struct lang_output_section_statement_struct
92 {
93 lang_statement_header_type header;
94 union etree_union *addr_tree;
95 lang_statement_list_type children;
96 CONST char *memspec;
97 union lang_statement_union *next;
98 CONST char *name;
99 unsigned long subsection_alignment;
100 boolean processed;
101
102 asection *bfd_section;
103 int flags;
104 struct memory_region_struct *region;
105 size_t block_value;
106 fill_type fill;
107 } lang_output_section_statement_type;
108
109
110 typedef struct {
111 lang_statement_header_type header;
112 } lang_common_statement_type;
113
114 typedef struct {
115 lang_statement_header_type header;
116 } lang_object_symbols_statement_type;
117
118 typedef struct {
119 lang_statement_header_type header;
120 fill_type fill;
121 } lang_fill_statement_type;
122
123 typedef struct {
124 lang_statement_header_type header;
125 unsigned int type;
126 union etree_union *exp;
127 bfd_vma value;
128 asection *output_section;
129 bfd_vma output_vma;
130 } lang_data_statement_type;
131
132
133
134
135 typedef struct lang_input_statement_struct
136 {
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;
144
145 bfd *the_bfd;
146
147 boolean closed;
148 file_ptr passive_position;
149
150 /* Symbol table of the file. */
151 asymbol **asymbols;
152 unsigned int symbol_count;
153
154 /* For library members only */
155
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
168 archives */
169
170 union lang_statement_union *next;
171 /* Point to the next file, but skips archive contents */
172 union lang_statement_union *next_real_file;
173
174 boolean is_archive;
175
176 /* 1 means search a set of directories for this file. */
177 boolean search_dirs_flag;
178
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. */
182
183 boolean just_syms_flag;
184
185 boolean loaded;
186
187
188 /* unsigned int globals_in_this_file;*/
189 CONST char *target;
190 boolean real;
191
192 asection *common_section;
193 asection *common_output_section;
194 } lang_input_statement_type;
195
196 typedef struct {
197 lang_statement_header_type header;
198 asection *section;
199 lang_input_statement_type *ifile;
200
201 } lang_input_section_type;
202
203
204 typedef struct {
205 lang_statement_header_type header;
206 asection *section;
207 union lang_statement_union *file;
208 } lang_afile_asection_pair_statement_type;
209
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;
216
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;
222
223 typedef struct {
224 lang_statement_header_type header;
225 bfd_vma output_offset;
226 size_t size;
227 asection *output_section;
228 fill_type fill;
229 } lang_padding_statement_type;
230
231 typedef union lang_statement_union
232 {
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;
250
251
252
253 PROTO(void,lang_init,(void));
254 PROTO(struct memory_region_struct ,
255 *lang_memory_region_lookup,(CONST
256 char *CONST));
257
258
259 PROTO(void ,lang_map,(FILE *));
260 PROTO(void,lang_set_flags,(int *, CONST char *));
261 PROTO(void,lang_add_output,(CONST char *));
262
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 *)));
281
282
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)\
289
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)\
296 { \
297 asection *section; \
298 bfd *abfd = statement->the_bfd; \
299 for (section = abfd->sections; \
300 section != (asection *)NULL; \
301 section = section->next) { \
302 x; \
303 } \
304 } \
305 }
306
307 #define LANG_FOR_EACH_OUTPUT_SECTION(section, x) \
308 { extern bfd *output_bfd; \
309 asection *section; \
310 for (section = output_bfd->sections; \
311 section != (asection *)NULL; \
312 section = section->next) \
313 { x; } \
314 }
315
316
317 PROTO(void, lang_process,(void));
318 PROTO(void, ldlang_add_file,(lang_input_statement_type *));
319
320 PROTO(lang_output_section_statement_type
321 *,lang_output_section_find,(CONST char * CONST));
322
323 PROTO(lang_input_statement_type *,
324 lang_add_input_file,(char *name,
325 lang_input_file_enum_type file_type,
326 char *target));
327 PROTO(lang_output_section_statement_type *,
328 lang_output_section_statement_lookup,(CONST char * CONST name));
329
330 PROTO(void, ldlang_add_undef,(CONST char *CONST name));
331 PROTO(void, lang_add_output_format,(CONST char *));
332
333
334 void EXFUN(lang_list_init,( lang_statement_list_type*));
335
336 void EXFUN(lang_add_data,(int type, union etree_union *));
This page took 0.050781 seconds and 4 git commands to generate.