* aclocal.m4, configure: Rebuilt.
[deliverable/binutils-gdb.git] / ld / ldlang.h
1 /* ldlang.h - linker command language support
2 Copyright 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
3
4 This file is part of GLD, the Gnu Linker.
5
6 GLD is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
9 any later version.
10
11 GLD is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GLD; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20 #ifndef LDLANG_H
21 #define LDLANG_H
22
23 typedef enum
24 {
25 lang_input_file_is_l_enum,
26 lang_input_file_is_symbols_only_enum,
27 lang_input_file_is_marker_enum,
28 lang_input_file_is_fake_enum,
29 lang_input_file_is_search_file_enum,
30 lang_input_file_is_file_enum
31 } lang_input_file_enum_type;
32
33 typedef unsigned int fill_type;
34 typedef struct statement_list
35 {
36 union lang_statement_union *head;
37 union lang_statement_union **tail;
38 } lang_statement_list_type;
39
40
41 typedef struct memory_region_struct
42 {
43 char *name;
44 struct memory_region_struct *next;
45 bfd_vma origin;
46 bfd_size_type length;
47 bfd_vma current;
48 bfd_size_type old_length;
49 int flags;
50 boolean had_full_message;
51 } lang_memory_region_type ;
52
53 typedef struct lang_statement_header_struct
54 {
55 union lang_statement_union *next;
56 enum statement_enum
57 {
58 lang_output_section_statement_enum,
59 lang_assignment_statement_enum,
60 lang_input_statement_enum,
61 lang_address_statement_enum,
62 lang_wild_statement_enum,
63 lang_input_section_enum,
64 lang_object_symbols_statement_enum,
65 lang_fill_statement_enum,
66 lang_data_statement_enum,
67 lang_reloc_statement_enum,
68 lang_target_statement_enum,
69 lang_output_statement_enum,
70 lang_padding_statement_enum,
71 lang_group_statement_enum,
72
73 lang_afile_asection_pair_statement_enum,
74 lang_constructors_statement_enum
75 } type;
76 } lang_statement_header_type;
77
78
79 typedef struct
80 {
81 lang_statement_header_type header;
82 union etree_union *exp;
83 } lang_assignment_statement_type;
84
85
86 typedef struct lang_target_statement_struct
87 {
88 lang_statement_header_type header;
89 const char *target;
90 } lang_target_statement_type;
91
92
93 typedef struct lang_output_statement_struct
94 {
95 lang_statement_header_type header;
96 const char *name;
97 } lang_output_statement_type;
98
99 /* Section types specified in a linker script. */
100
101 enum section_type
102 {
103 normal_section,
104 dsect_section,
105 copy_section,
106 noload_section,
107 info_section,
108 overlay_section
109 };
110
111 /* This structure holds a list of program headers describing segments
112 in which this section should be placed. */
113
114 struct lang_output_section_phdr_list
115 {
116 struct lang_output_section_phdr_list *next;
117 const char *name;
118 boolean used;
119 };
120
121 typedef struct lang_output_section_statement_struct
122 {
123 lang_statement_header_type header;
124 union etree_union *addr_tree;
125 lang_statement_list_type children;
126 const char *memspec;
127 union lang_statement_union *next;
128 const char *name;
129
130 boolean processed;
131
132 asection *bfd_section;
133 int flags; /* Or together of all input sections */
134 enum section_type sectype;
135 struct memory_region_struct *region;
136 size_t block_value;
137 fill_type fill;
138
139 int subsection_alignment; /* alignment of components */
140 int section_alignment; /* alignment of start of section */
141
142 union etree_union *load_base;
143
144 struct lang_output_section_phdr_list *phdrs;
145 } lang_output_section_statement_type;
146
147
148 typedef struct
149 {
150 lang_statement_header_type header;
151 } lang_common_statement_type;
152
153 typedef struct
154 {
155 lang_statement_header_type header;
156 } lang_object_symbols_statement_type;
157
158 typedef struct
159 {
160 lang_statement_header_type header;
161 fill_type fill;
162 int size;
163 asection *output_section;
164 } lang_fill_statement_type;
165
166 typedef struct
167 {
168 lang_statement_header_type header;
169 unsigned int type;
170 union etree_union *exp;
171 bfd_vma value;
172 asection *output_section;
173 bfd_vma output_vma;
174 } lang_data_statement_type;
175
176 /* Generate a reloc in the output file. */
177
178 typedef struct
179 {
180 lang_statement_header_type header;
181
182 /* Reloc to generate. */
183 bfd_reloc_code_real_type reloc;
184
185 /* Reloc howto structure. */
186 reloc_howto_type *howto;
187
188 /* Section to generate reloc against. Exactly one of section and
189 name must be NULL. */
190 asection *section;
191
192 /* Name of symbol to generate reloc against. Exactly one of section
193 and name must be NULL. */
194 const char *name;
195
196 /* Expression for addend. */
197 union etree_union *addend_exp;
198
199 /* Resolved addend. */
200 bfd_vma addend_value;
201
202 /* Output section where reloc should be performed. */
203 asection *output_section;
204
205 /* VMA within output section. */
206 bfd_vma output_vma;
207 } lang_reloc_statement_type;
208
209 typedef struct lang_input_statement_struct
210 {
211 lang_statement_header_type header;
212 /* Name of this file. */
213 const char *filename;
214 /* Name to use for the symbol giving address of text start */
215 /* Usually the same as filename, but for a file spec'd with -l
216 this is the -l switch itself rather than the filename. */
217 const char *local_sym_name;
218
219 bfd *the_bfd;
220
221 boolean closed;
222 file_ptr passive_position;
223
224 /* Symbol table of the file. */
225 asymbol **asymbols;
226 unsigned int symbol_count;
227
228 /* Point to the next file - whatever it is, wanders up and down
229 archives */
230
231 union lang_statement_union *next;
232 /* Point to the next file, but skips archive contents */
233 union lang_statement_union *next_real_file;
234
235 boolean is_archive;
236
237 /* 1 means search a set of directories for this file. */
238 boolean search_dirs_flag;
239
240 /* 1 means this is base file of incremental load.
241 Do not load this file's text or data.
242 Also default text_start to after this file's bss. */
243
244 boolean just_syms_flag;
245
246 /* Whether to search for this entry as a dynamic archive. */
247 boolean dynamic;
248
249 /* Whether to include the entire contents of an archive. */
250 boolean whole_archive;
251
252 boolean loaded;
253
254 /* unsigned int globals_in_this_file;*/
255 const char *target;
256 boolean real;
257 } lang_input_statement_type;
258
259 typedef struct
260 {
261 lang_statement_header_type header;
262 asection *section;
263 lang_input_statement_type *ifile;
264
265 } lang_input_section_type;
266
267
268 typedef struct
269 {
270 lang_statement_header_type header;
271 asection *section;
272 union lang_statement_union *file;
273 } lang_afile_asection_pair_statement_type;
274
275 typedef struct lang_wild_statement_struct
276 {
277 lang_statement_header_type header;
278 const char *section_name;
279 const char *filename;
280 lang_statement_list_type children;
281 } lang_wild_statement_type;
282
283 typedef struct lang_address_statement_struct
284 {
285 lang_statement_header_type header;
286 const char *section_name;
287 union etree_union *address;
288 } lang_address_statement_type;
289
290 typedef struct
291 {
292 lang_statement_header_type header;
293 bfd_vma output_offset;
294 size_t size;
295 asection *output_section;
296 fill_type fill;
297 } lang_padding_statement_type;
298
299 /* A group statement collects a set of libraries together. The
300 libraries are searched multiple times, until no new undefined
301 symbols are found. The effect is to search a group of libraries as
302 though they were a single library. */
303
304 typedef struct
305 {
306 lang_statement_header_type header;
307 lang_statement_list_type children;
308 } lang_group_statement_type;
309
310 typedef union lang_statement_union
311 {
312 lang_statement_header_type header;
313 union lang_statement_union *next;
314 lang_wild_statement_type wild_statement;
315 lang_data_statement_type data_statement;
316 lang_reloc_statement_type reloc_statement;
317 lang_address_statement_type address_statement;
318 lang_output_section_statement_type output_section_statement;
319 lang_afile_asection_pair_statement_type afile_asection_pair_statement;
320 lang_assignment_statement_type assignment_statement;
321 lang_input_statement_type input_statement;
322 lang_target_statement_type target_statement;
323 lang_output_statement_type output_statement;
324 lang_input_section_type input_section;
325 lang_common_statement_type common_statement;
326 lang_object_symbols_statement_type object_symbols_statement;
327 lang_fill_statement_type fill_statement;
328 lang_padding_statement_type padding_statement;
329 lang_group_statement_type group_statement;
330 } lang_statement_union_type;
331
332 /* This structure holds information about a program header, from the
333 PHDRS command in the linker script. */
334
335 struct lang_phdr
336 {
337 struct lang_phdr *next;
338 const char *name;
339 unsigned long type;
340 boolean filehdr;
341 boolean phdrs;
342 etree_type *at;
343 etree_type *flags;
344 };
345
346 /* This structure is used to hold a list of sections which may not
347 cross reference each other. */
348
349 struct lang_nocrossref
350 {
351 struct lang_nocrossref *next;
352 const char *name;
353 };
354
355 /* The list of nocrossref lists. */
356
357 struct lang_nocrossrefs
358 {
359 struct lang_nocrossrefs *next;
360 struct lang_nocrossref *list;
361 };
362
363 extern struct lang_nocrossrefs *nocrossref_list;
364
365 extern lang_output_section_statement_type *abs_output_section;
366 extern boolean lang_has_input_file;
367 extern etree_type *base;
368 extern lang_statement_list_type *stat_ptr;
369 extern boolean delete_output_file_on_failure;
370
371 extern const char *entry_symbol;
372 extern boolean entry_from_cmdline;
373
374 extern void lang_init PARAMS ((void));
375 extern struct memory_region_struct *lang_memory_region_lookup
376 PARAMS ((const char *const));
377 extern void lang_map PARAMS ((void));
378 extern void lang_set_flags PARAMS ((int *, const char *));
379 extern void lang_add_output PARAMS ((const char *, int from_script));
380 extern void lang_enter_output_section_statement
381 PARAMS ((const char *output_section_statement_name,
382 etree_type * address_exp,
383 enum section_type sectype,
384 bfd_vma block_value,
385 etree_type *align,
386 etree_type *subalign,
387 etree_type *));
388 extern void lang_final PARAMS ((void));
389 extern void lang_process PARAMS ((void));
390 extern void lang_section_start PARAMS ((const char *, union etree_union *));
391 extern void lang_add_entry PARAMS ((const char *, boolean));
392 extern void lang_add_target PARAMS ((const char *));
393 extern void lang_add_wild PARAMS ((const char *const , const char *const));
394 extern void lang_add_map PARAMS ((const char *));
395 extern void lang_add_fill PARAMS ((int));
396 extern void lang_add_assignment PARAMS ((union etree_union *));
397 extern void lang_add_attribute PARAMS ((enum statement_enum));
398 extern void lang_startup PARAMS ((const char *));
399 extern void lang_float PARAMS ((enum bfd_boolean));
400 extern void lang_leave_output_section_statement PARAMS ((bfd_vma,
401 const char *));
402 extern void lang_abs_symbol_at_end_of PARAMS ((const char *, const char *));
403 extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *,
404 const char *));
405 extern void lang_statement_append PARAMS ((struct statement_list *,
406 union lang_statement_union *,
407 union lang_statement_union **));
408 extern void lang_for_each_input_file
409 PARAMS ((void (*dothis) (lang_input_statement_type *)));
410 extern void lang_for_each_file
411 PARAMS ((void (*dothis) (lang_input_statement_type *)));
412 extern bfd_vma lang_do_assignments
413 PARAMS ((lang_statement_union_type * s,
414 lang_output_section_statement_type *output_section_statement,
415 fill_type fill,
416 bfd_vma dot));
417
418 #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
419 extern lang_statement_list_type file_chain; \
420 lang_input_statement_type *statement; \
421 for (statement = (lang_input_statement_type *)file_chain.head;\
422 statement != (lang_input_statement_type *)NULL; \
423 statement = (lang_input_statement_type *)statement->next)\
424
425 extern void lang_process PARAMS ((void));
426 extern void ldlang_add_file PARAMS ((lang_input_statement_type *));
427 extern lang_output_section_statement_type *lang_output_section_find
428 PARAMS ((const char * const));
429 extern lang_input_statement_type *lang_add_input_file
430 PARAMS ((const char *name, lang_input_file_enum_type file_type,
431 const char *target));
432 extern void lang_add_keepsyms_file PARAMS ((const char *filename));
433 extern lang_output_section_statement_type *
434 lang_output_section_statement_lookup PARAMS ((const char * const name));
435 extern void ldlang_add_undef PARAMS ((const char *const name));
436 extern void lang_add_output_format PARAMS ((const char *, const char *,
437 const char *, int from_script));
438 extern void lang_list_init PARAMS ((lang_statement_list_type*));
439 extern void lang_add_data PARAMS ((int type, union etree_union *));
440 extern void lang_add_reloc
441 PARAMS ((bfd_reloc_code_real_type reloc, reloc_howto_type *howto,
442 asection *section, const char *name, union etree_union *addend));
443 extern void lang_for_each_statement
444 PARAMS ((void (*func) (lang_statement_union_type *)));
445 extern PTR stat_alloc PARAMS ((size_t size));
446 extern bfd_vma lang_size_sections
447 PARAMS ((lang_statement_union_type *s,
448 lang_output_section_statement_type *output_section_statement,
449 lang_statement_union_type **prev, fill_type fill,
450 bfd_vma dot, boolean relax));
451 extern void lang_enter_group PARAMS ((void));
452 extern void lang_leave_group PARAMS ((void));
453 extern void wild_doit
454 PARAMS ((lang_statement_list_type *ptr, asection *section,
455 lang_output_section_statement_type *output,
456 lang_input_statement_type *file));
457 extern void lang_new_phdr
458 PARAMS ((const char *, etree_type *, boolean, boolean, etree_type *,
459 etree_type *));
460 extern void lang_section_in_phdr PARAMS ((const char *));
461 extern void lang_add_nocrossref PARAMS ((struct lang_nocrossref *));
462
463 #endif
This page took 0.039438 seconds and 4 git commands to generate.