* mipsread.c: Pass NULL name pointer to init_type, not 0.
[deliverable/binutils-gdb.git] / ld / ldlang.h
CommitLineData
2fa0b342 1/* ldlang.h -
c611e285 2
2fa0b342 3 Copyright (C) 1991 Free Software Foundation, Inc.
c611e285 4
2fa0b342 5 This file is part of GLD, the Gnu Linker.
c611e285 6
2fa0b342
DHW
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.
c611e285 11
2fa0b342
DHW
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.
c611e285 16
2fa0b342
DHW
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
22typedef 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,
c611e285 27 lang_input_file_is_search_file_enum,
2fa0b342
DHW
28 lang_input_file_is_file_enum } lang_input_file_enum_type;
29
30typedef unsigned short fill_type;
31typedef struct statement_list {
32 union lang_statement_union *head;
33 union lang_statement_union **tail;
34} lang_statement_list_type;
35
36
c611e285 37
2fa0b342
DHW
38
39typedef 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;
c611e285 45 int flags;
1bd1fa2d
SC
46 boolean had_full_message;
47
2fa0b342
DHW
48} lang_memory_region_type ;
49
50typedef struct lang_statement_header_struct
c611e285
SC
51 {
52 union lang_statement_union *next;
53 enum statement_enum {
54 lang_output_section_statement_enum,
55 lang_assignment_statement_enum,
56 lang_input_statement_enum,
57 lang_address_statement_enum,
58 lang_wild_statement_enum,
59 lang_input_section_enum,
60 lang_object_symbols_statement_enum,
61 lang_fill_statement_enum,
62 lang_data_statement_enum,
63 lang_target_statement_enum,
64 lang_output_statement_enum,
65 lang_padding_statement_enum,
66
67 lang_afile_asection_pair_statement_enum,
68 lang_constructors_statement_enum
69 } type;
70
71 } lang_statement_header_type;
2fa0b342
DHW
72
73
74typedef struct
c611e285
SC
75 {
76 lang_statement_header_type header;
77 union etree_union *exp;
78 } lang_assignment_statement_type;
2fa0b342
DHW
79
80
81typedef struct lang_target_statement_struct {
82 lang_statement_header_type header;
1418c83b 83 CONST char *target;
2fa0b342
DHW
84} lang_target_statement_type;
85
86
87typedef struct lang_output_statement_struct {
88 lang_statement_header_type header;
1418c83b 89 CONST char *name;
2fa0b342
DHW
90} lang_output_statement_type;
91
92
93typedef struct lang_output_section_statement_struct
c611e285
SC
94 {
95 lang_statement_header_type header;
96 union etree_union *addr_tree;
97 lang_statement_list_type children;
98 CONST char *memspec;
99 union lang_statement_union *next;
100 CONST char *name;
101 unsigned long subsection_alignment;
102 boolean processed;
103
104 asection *bfd_section;
105 int flags;
106 struct memory_region_struct *region;
107 size_t block_value;
108 fill_type fill;
109 } lang_output_section_statement_type;
2fa0b342
DHW
110
111
112typedef struct {
113 lang_statement_header_type header;
114} lang_common_statement_type;
115
116typedef struct {
117 lang_statement_header_type header;
118} lang_object_symbols_statement_type;
119
120typedef struct {
121 lang_statement_header_type header;
1418c83b 122 fill_type fill;
bfbdc80f
SC
123 int size;
124 asection *output_section;
2fa0b342
DHW
125} lang_fill_statement_type;
126
127typedef struct {
128 lang_statement_header_type header;
129 unsigned int type;
130 union etree_union *exp;
131 bfd_vma value;
132 asection *output_section;
133 bfd_vma output_vma;
134} lang_data_statement_type;
135
136
137
138
139typedef struct lang_input_statement_struct
140 {
141 lang_statement_header_type header;
142 /* Name of this file. */
1418c83b 143 CONST char *filename;
2fa0b342
DHW
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. */
1418c83b 147 CONST char *local_sym_name;
c611e285 148
2fa0b342 149 bfd *the_bfd;
c611e285 150
2fa0b342
DHW
151 boolean closed;
152 file_ptr passive_position;
c611e285 153
2fa0b342
DHW
154 /* Symbol table of the file. */
155 asymbol **asymbols;
156 unsigned int symbol_count;
c611e285 157
2fa0b342 158 /* For library members only */
c611e285 159
2fa0b342
DHW
160 /* For a library, points to chain of entries for the library members. */
161 struct lang_input_statement_struct *subfiles;
162 /* For a library member, offset of the member within the archive.
163 Zero for files that are not library members. */
164 /* int starting_offset;*/
165 /* Size of contents of this file, if library member. */
c611e285 166 bfd_size_type total_size;
2fa0b342
DHW
167 /* For library member, points to the library's own entry. */
168 struct lang_input_statement_struct *superfile;
169 /* For library member, points to next entry for next member. */
170 struct lang_input_statement_struct *chain;
1418c83b
SC
171 /* Point to the next file - whatever it is, wanders up and down
172 archives */
c611e285 173
2fa0b342
DHW
174 union lang_statement_union *next;
175 /* Point to the next file, but skips archive contents */
176 union lang_statement_union *next_real_file;
c611e285 177
2fa0b342 178 boolean is_archive;
c611e285 179
2fa0b342
DHW
180 /* 1 means search a set of directories for this file. */
181 boolean search_dirs_flag;
c611e285 182
2fa0b342
DHW
183 /* 1 means this is base file of incremental load.
184 Do not load this file's text or data.
185 Also default text_start to after this file's bss. */
c611e285 186
2fa0b342 187 boolean just_syms_flag;
c611e285 188
2fa0b342 189 boolean loaded;
c611e285
SC
190
191
2fa0b342 192 /* unsigned int globals_in_this_file;*/
1418c83b 193 CONST char *target;
2fa0b342 194 boolean real;
c611e285 195
2fa0b342
DHW
196 asection *common_section;
197 asection *common_output_section;
198 } lang_input_statement_type;
199
200typedef struct {
201 lang_statement_header_type header;
202 asection *section;
203 lang_input_statement_type *ifile;
c611e285 204
2fa0b342
DHW
205} lang_input_section_type;
206
207
208typedef struct {
209 lang_statement_header_type header;
210 asection *section;
211 union lang_statement_union *file;
212} lang_afile_asection_pair_statement_type;
213
214typedef struct lang_wild_statement_struct {
215 lang_statement_header_type header;
c611e285
SC
216 CONST char *section_name;
217 CONST char *filename;
2fa0b342
DHW
218 lang_statement_list_type children;
219} lang_wild_statement_type;
220
221typedef struct lang_address_statement_struct {
222 lang_statement_header_type header;
1418c83b 223 CONST char *section_name;
2fa0b342
DHW
224 union etree_union *address;
225} lang_address_statement_type;
226
227typedef struct {
228 lang_statement_header_type header;
229 bfd_vma output_offset;
230 size_t size;
231 asection *output_section;
232 fill_type fill;
233} lang_padding_statement_type;
234
235typedef union lang_statement_union
c611e285
SC
236 {
237 lang_statement_header_type header;
238 union lang_statement_union *next;
239 lang_wild_statement_type wild_statement;
240 lang_data_statement_type data_statement;
241 lang_address_statement_type address_statement;
242 lang_output_section_statement_type output_section_statement;
243 lang_afile_asection_pair_statement_type afile_asection_pair_statement;
244 lang_assignment_statement_type assignment_statement;
245 lang_input_statement_type input_statement;
246 lang_target_statement_type target_statement;
247 lang_output_statement_type output_statement;
248 lang_input_section_type input_section;
249 lang_common_statement_type common_statement;
250 lang_object_symbols_statement_type object_symbols_statement;
251 lang_fill_statement_type fill_statement;
252 lang_padding_statement_type padding_statement;
253 } lang_statement_union_type;
2fa0b342
DHW
254
255
256
257PROTO(void,lang_init,(void));
1418c83b
SC
258PROTO(struct memory_region_struct ,
259 *lang_memory_region_lookup,(CONST
260 char *CONST));
2fa0b342 261
1418c83b 262
1bd1fa2d 263PROTO(void ,lang_map,(void));
c611e285 264PROTO(void,lang_set_flags,(int *, CONST char *));
1418c83b 265PROTO(void,lang_add_output,(CONST char *));
2fa0b342
DHW
266
267PROTO(void,lang_final,(void));
b6316534 268PROTO(struct symbol_cache_entry *,create_symbol,(CONST char *, unsigned int, struct sec *));
2fa0b342 269PROTO(void ,lang_process,(void));
1418c83b
SC
270PROTO(void ,lang_section_start,(CONST char *, union etree_union *));
271PROTO(void,lang_add_entry,(CONST char *));
272PROTO(void,lang_add_target,(CONST char *));
273PROTO(void,lang_add_wild,(CONST char *CONST , CONST char *CONST));
274PROTO(void,lang_add_map,(CONST char *));
2fa0b342
DHW
275PROTO(void,lang_add_fill,(int));
276PROTO(void,lang_add_assignment,(union etree_union *));
277PROTO(void,lang_add_attribute,(enum statement_enum));
1418c83b 278PROTO(void,lang_startup,(CONST char *));
c611e285 279PROTO(void,lang_float,(enum bfd_boolean));
1418c83b
SC
280PROTO(void,lang_leave_output_section_statement,(bfd_vma, CONST char *));
281PROTO(void,lang_abs_symbol_at_end_of,(CONST char *, CONST char *));
282PROTO(void,lang_abs_symbol_at_beginning_of,(CONST char *, CONST char *));
2fa0b342
DHW
283PROTO(void,lang_statement_append,(struct statement_list *, union lang_statement_union *, union lang_statement_union **));
284PROTO(void, lang_for_each_file,(void (*dothis)(lang_input_statement_type *)));
285
c611e285 286
2fa0b342
DHW
287#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
288 extern lang_statement_list_type file_chain; \
289 lang_input_statement_type *statement; \
290 for (statement = (lang_input_statement_type *)file_chain.head;\
291 statement != (lang_input_statement_type *)NULL; \
292 statement = (lang_input_statement_type *)statement->next)\
c611e285 293
2fa0b342 294#define LANG_FOR_EACH_INPUT_SECTION(statement, abfd, section, x) \
c611e285
SC
295 { extern lang_statement_list_type file_chain; \
296 lang_input_statement_type *statement; \
297 for (statement = (lang_input_statement_type *)file_chain.head;\
298 statement != (lang_input_statement_type *)NULL; \
299 statement = (lang_input_statement_type *)statement->next)\
300 { \
301 asection *section; \
302 bfd *abfd = statement->the_bfd; \
2fa0b342
DHW
303 for (section = abfd->sections; \
304 section != (asection *)NULL; \
305 section = section->next) { \
c611e285
SC
306 x; \
307 } \
308 } \
2fa0b342
DHW
309 }
310
311#define LANG_FOR_EACH_OUTPUT_SECTION(section, x) \
c611e285
SC
312 { extern bfd *output_bfd; \
313 asection *section; \
314 for (section = output_bfd->sections; \
315 section != (asection *)NULL; \
316 section = section->next) \
317 { x; } \
318 }
319
2fa0b342
DHW
320
321PROTO(void, lang_process,(void));
322PROTO(void, ldlang_add_file,(lang_input_statement_type *));
323
1418c83b
SC
324PROTO(lang_output_section_statement_type
325 *,lang_output_section_find,(CONST char * CONST));
2fa0b342
DHW
326
327PROTO(lang_input_statement_type *,
1bd1fa2d 328 lang_add_input_file,(CONST char *name,
c611e285 329 lang_input_file_enum_type file_type,
1bd1fa2d 330 CONST char *target));
2fa0b342 331PROTO(lang_output_section_statement_type *,
c611e285 332 lang_output_section_statement_lookup,(CONST char * CONST name));
1418c83b
SC
333
334PROTO(void, ldlang_add_undef,(CONST char *CONST name));
a37cc0c0 335PROTO(void, lang_add_output_format,(CONST char *));
c611e285
SC
336
337
338void EXFUN(lang_list_init,( lang_statement_list_type*));
339
340void EXFUN(lang_add_data,(int type, union etree_union *));
1bd1fa2d
SC
341
342void EXFUN(lang_for_each_statement,(void (*func)()));
343
bfbdc80f 344PTR EXFUN(stat_alloc,(size_t size));
This page took 0.067191 seconds and 4 git commands to generate.