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