Remove rcfonts.tex after building refcard.
[deliverable/binutils-gdb.git] / ld / ldlang.h
CommitLineData
2fa0b342
DHW
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
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,
27lang_input_file_is_search_file_enum,
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
37typedef struct {
38 boolean flag_read;
39 boolean flag_write;
40 boolean flag_executable;
41 boolean flag_loadable;
42} lang_section_flags_type;
43
44typedef struct memory_region_struct {
45 char *name;
46 struct memory_region_struct *next;
47 bfd_vma origin;
48 bfd_offset length;
49 bfd_vma current;
50 lang_section_flags_type flags;
51} lang_memory_region_type ;
52
53typedef struct lang_statement_header_struct
54{
55union lang_statement_union *next;
56 enum statement_enum {
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,
2fa0b342
DHW
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,
69
70 lang_afile_asection_pair_statement_enum
71 } type;
72
73} lang_statement_header_type;
74
75
76typedef struct
77{
78 lang_statement_header_type header;
79 union etree_union *exp;
80} lang_assignment_statement_type;
81
82
83typedef struct lang_target_statement_struct {
84 lang_statement_header_type header;
1418c83b 85 CONST char *target;
2fa0b342
DHW
86} lang_target_statement_type;
87
88
89typedef struct lang_output_statement_struct {
90 lang_statement_header_type header;
1418c83b 91 CONST char *name;
2fa0b342
DHW
92} lang_output_statement_type;
93
94
95typedef struct lang_output_section_statement_struct
96{
97 lang_statement_header_type header;
98 union etree_union *addr_tree;
99 lang_statement_list_type children;
1418c83b 100 CONST char *memspec;
2fa0b342 101 union lang_statement_union *next;
1418c83b 102 CONST char *name;
2fa0b342
DHW
103 unsigned long subsection_alignment;
104 boolean processed;
105
106 asection *bfd_section;
107 lang_section_flags_type flags;
108 struct memory_region_struct *region;
109 size_t block_value;
110 fill_type fill;
111} lang_output_section_statement_type;
112
113
114typedef struct {
115 lang_statement_header_type header;
116} lang_common_statement_type;
117
118typedef struct {
119 lang_statement_header_type header;
120} lang_object_symbols_statement_type;
121
122typedef struct {
123 lang_statement_header_type header;
1418c83b 124 fill_type fill;
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;
2fa0b342
DHW
148
149 /* Describe the layout of the contents of the file */
150
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. */
154 int symseg_offset;
155
156 /* Describe data from the file loaded into core */
157
158 bfd *the_bfd;
159
160 boolean closed;
161 file_ptr passive_position;
162
163 /* Symbol table of the file. */
164 asymbol **asymbols;
165 unsigned int symbol_count;
166
2fa0b342
DHW
167 /* For library members only */
168
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. */
175 int total_size;
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;
1418c83b
SC
180 /* Point to the next file - whatever it is, wanders up and down
181 archives */
182
2fa0b342
DHW
183 union lang_statement_union *next;
184 /* Point to the next file, but skips archive contents */
185 union lang_statement_union *next_real_file;
186
187 boolean is_archive;
188
2fa0b342
DHW
189 /* 1 means search a set of directories for this file. */
190 boolean search_dirs_flag;
191
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. */
1418c83b 195
2fa0b342
DHW
196 boolean just_syms_flag;
197
198 boolean loaded;
199
200
201 /* unsigned int globals_in_this_file;*/
1418c83b 202 CONST char *target;
2fa0b342
DHW
203 boolean real;
204
205 asection *common_section;
206 asection *common_output_section;
207 } lang_input_statement_type;
208
209typedef struct {
210 lang_statement_header_type header;
211 asection *section;
212 lang_input_statement_type *ifile;
1418c83b 213
2fa0b342
DHW
214} lang_input_section_type;
215
216
217typedef struct {
218 lang_statement_header_type header;
219 asection *section;
220 union lang_statement_union *file;
221} lang_afile_asection_pair_statement_type;
222
223typedef struct lang_wild_statement_struct {
224 lang_statement_header_type header;
1418c83b
SC
225CONST char *section_name;
226CONST char *filename;
2fa0b342
DHW
227 lang_statement_list_type children;
228} lang_wild_statement_type;
229
230typedef struct lang_address_statement_struct {
231 lang_statement_header_type header;
1418c83b 232 CONST char *section_name;
2fa0b342
DHW
233 union etree_union *address;
234} lang_address_statement_type;
235
236typedef struct {
237 lang_statement_header_type header;
238 bfd_vma output_offset;
239 size_t size;
240 asection *output_section;
241 fill_type fill;
242} lang_padding_statement_type;
243
244typedef union lang_statement_union
245{
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;
263
264
265
266PROTO(void,lang_init,(void));
1418c83b
SC
267PROTO(struct memory_region_struct ,
268 *lang_memory_region_lookup,(CONST
269 char *CONST));
2fa0b342 270
1418c83b
SC
271
272PROTO(void ,lang_map,(FILE *));
273PROTO(void,lang_set_flags,(lang_section_flags_type *, CONST char *));
274PROTO(void,lang_add_output,(CONST char *));
2fa0b342
DHW
275
276PROTO(void,lang_final,(void));
b6316534 277PROTO(struct symbol_cache_entry *,create_symbol,(CONST char *, unsigned int, struct sec *));
2fa0b342 278PROTO(void ,lang_process,(void));
1418c83b
SC
279PROTO(void ,lang_section_start,(CONST char *, union etree_union *));
280PROTO(void,lang_add_entry,(CONST char *));
281PROTO(void,lang_add_target,(CONST char *));
282PROTO(void,lang_add_wild,(CONST char *CONST , CONST char *CONST));
283PROTO(void,lang_add_map,(CONST char *));
2fa0b342
DHW
284PROTO(void,lang_add_fill,(int));
285PROTO(void,lang_add_assignment,(union etree_union *));
286PROTO(void,lang_add_attribute,(enum statement_enum));
1418c83b 287PROTO(void,lang_startup,(CONST char *));
2fa0b342 288PROTO(void,lang_float,(enum boolean));
1418c83b
SC
289PROTO(void,lang_leave_output_section_statement,(bfd_vma, CONST char *));
290PROTO(void,lang_abs_symbol_at_end_of,(CONST char *, CONST char *));
291PROTO(void,lang_abs_symbol_at_beginning_of,(CONST char *, CONST char *));
2fa0b342
DHW
292PROTO(void,lang_statement_append,(struct statement_list *, union lang_statement_union *, union lang_statement_union **));
293PROTO(void, lang_for_each_file,(void (*dothis)(lang_input_statement_type *)));
294
2fa0b342
DHW
295
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)\
302
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)\
309 { \
310 asection *section; \
311 bfd *abfd = statement->the_bfd; \
312 for (section = abfd->sections; \
313 section != (asection *)NULL; \
314 section = section->next) { \
315 x; \
316 } \
317 } \
318 }
319
320#define LANG_FOR_EACH_OUTPUT_SECTION(section, x) \
321 { extern bfd *output_bfd; \
322 asection *section; \
323 for (section = output_bfd->sections; \
324 section != (asection *)NULL; \
325 section = section->next) \
326 { x; } \
327 }
328
329
330PROTO(void, lang_process,(void));
331PROTO(void, ldlang_add_file,(lang_input_statement_type *));
332
1418c83b
SC
333PROTO(lang_output_section_statement_type
334 *,lang_output_section_find,(CONST char * CONST));
2fa0b342
DHW
335
336PROTO(lang_input_statement_type *,
337 lang_add_input_file,(char *name,
338 lang_input_file_enum_type file_type,
339 char *target));
340PROTO(lang_output_section_statement_type *,
1418c83b
SC
341lang_output_section_statement_lookup,(CONST char * CONST name));
342
343PROTO(void, ldlang_add_undef,(CONST char *CONST name));
a37cc0c0 344PROTO(void, lang_add_output_format,(CONST char *));
This page took 0.071585 seconds and 4 git commands to generate.