Rev 5199 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5199 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* ldlang.h - linker command language support |
1 | /* ldlang.h - linker command language support |
2 | Copyright 1991-2013 Free Software Foundation, Inc. |
2 | Copyright (C) 1991-2015 Free Software Foundation, Inc. |
Line 3... | Line 3... | ||
3 | 3 | ||
Line 4... | Line 4... | ||
4 | This file is part of the GNU Binutils. |
4 | This file is part of the GNU Binutils. |
5 | 5 | ||
Line 53... | Line 53... | ||
53 | 53 | ||
54 | typedef struct memory_region_struct |
54 | typedef struct memory_region_struct |
55 | { |
55 | { |
56 | lang_memory_region_name name_list; |
56 | lang_memory_region_name name_list; |
- | 57 | struct memory_region_struct *next; |
|
57 | struct memory_region_struct *next; |
58 | union etree_union *origin_exp; |
58 | bfd_vma origin; |
59 | bfd_vma origin; |
- | 60 | bfd_size_type length; |
|
59 | bfd_size_type length; |
61 | union etree_union *length_exp; |
60 | bfd_vma current; |
62 | bfd_vma current; |
61 | union lang_statement_union *last_os; |
63 | union lang_statement_union *last_os; |
62 | flagword flags; |
64 | flagword flags; |
63 | flagword not_flags; |
65 | flagword not_flags; |
Line 233... | Line 235... | ||
233 | struct lang_input_statement_flags |
235 | struct lang_input_statement_flags |
234 | { |
236 | { |
235 | /* 1 means this file was specified in a -l option. */ |
237 | /* 1 means this file was specified in a -l option. */ |
236 | unsigned int maybe_archive : 1; |
238 | unsigned int maybe_archive : 1; |
Line -... | Line 239... | ||
- | 239 | ||
- | 240 | /* 1 means this file was specified in a -l:namespec option. */ |
|
- | 241 | unsigned int full_name_provided : 1; |
|
237 | 242 | ||
238 | /* 1 means search a set of directories for this file. */ |
243 | /* 1 means search a set of directories for this file. */ |
Line 239... | Line 244... | ||
239 | unsigned int search_dirs : 1; |
244 | unsigned int search_dirs : 1; |
240 | 245 | ||
Line 267... | Line 272... | ||
267 | unsigned int real : 1; |
272 | unsigned int real : 1; |
Line 268... | Line 273... | ||
268 | 273 | ||
269 | /* Set if the file does not exist. */ |
274 | /* Set if the file does not exist. */ |
Line -... | Line 275... | ||
- | 275 | unsigned int missing_file : 1; |
|
- | 276 | ||
- | 277 | /* Set if reloading an archive or --as-needed lib. */ |
|
270 | unsigned int missing_file : 1; |
278 | unsigned int reload : 1; |
271 | 279 | ||
272 | #ifdef ENABLE_PLUGINS |
280 | #ifdef ENABLE_PLUGINS |
Line 273... | Line 281... | ||
273 | /* Set if the file was claimed by a plugin. */ |
281 | /* Set if the file was claimed by a plugin. */ |
274 | unsigned int claimed : 1; |
282 | unsigned int claimed : 1; |
Line 275... | Line 283... | ||
275 | 283 | ||
276 | /* Set if the file was claimed from an archive. */ |
284 | /* Set if the file was claimed from an archive. */ |
277 | unsigned int claim_archive : 1; |
285 | unsigned int claim_archive : 1; |
- | 286 | ||
- | 287 | /* Set if added by the lto plugin add_input_file callback. */ |
|
- | 288 | unsigned int lto_output : 1; |
|
278 | 289 | #endif /* ENABLE_PLUGINS */ |
|
Line 279... | Line 290... | ||
279 | /* Set if reloading an --as-needed lib. */ |
290 | |
280 | unsigned int reload : 1; |
291 | /* Head of list of pushed flags. */ |
281 | #endif /* ENABLE_PLUGINS */ |
292 | struct lang_input_statement_flags *pushed; |
Line 311... | Line 322... | ||
311 | { |
322 | { |
312 | lang_statement_header_type header; |
323 | lang_statement_header_type header; |
313 | asection *section; |
324 | asection *section; |
314 | } lang_input_section_type; |
325 | } lang_input_section_type; |
Line -... | Line 326... | ||
- | 326 | ||
- | 327 | struct map_symbol_def { |
|
- | 328 | struct bfd_link_hash_entry *entry; |
|
- | 329 | struct map_symbol_def *next; |
|
- | 330 | }; |
|
- | 331 | ||
- | 332 | /* For input sections, when writing a map file: head / tail of a linked |
|
- | 333 | list of hash table entries for symbols defined in this section. */ |
|
- | 334 | typedef struct input_section_userdata_struct |
|
- | 335 | { |
|
- | 336 | struct map_symbol_def *map_symbol_def_head; |
|
- | 337 | struct map_symbol_def **map_symbol_def_tail; |
|
- | 338 | unsigned long map_symbol_def_count; |
|
- | 339 | } input_section_userdata_type; |
|
- | 340 | ||
- | 341 | #define get_userdata(x) ((x)->userdata) |
|
- | 342 | ||
315 | 343 | ||
Line 316... | Line 344... | ||
316 | typedef struct lang_wild_statement_struct lang_wild_statement_type; |
344 | typedef struct lang_wild_statement_struct lang_wild_statement_type; |
317 | 345 | ||
318 | typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, |
346 | typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *, |
Line 445... | Line 473... | ||
445 | { |
473 | { |
446 | struct unique_sections *next; |
474 | struct unique_sections *next; |
447 | const char *name; |
475 | const char *name; |
448 | }; |
476 | }; |
Line 449... | Line -... | ||
449 | - | ||
450 | /* This structure records symbols for which we need to keep track of |
- | |
451 | definedness for use in the DEFINED () test. */ |
- | |
452 | - | ||
453 | struct lang_definedness_hash_entry |
- | |
454 | { |
- | |
455 | struct bfd_hash_entry root; |
- | |
456 | int iteration; |
- | |
457 | }; |
- | |
458 | 477 | ||
Line 459... | Line 478... | ||
459 | /* Used by place_orphan to keep track of orphan sections and statements. */ |
478 | /* Used by place_orphan to keep track of orphan sections and statements. */ |
460 | 479 | ||
461 | struct orphan_save |
480 | struct orphan_save |
Line 466... | Line 485... | ||
466 | asection **section; |
485 | asection **section; |
467 | lang_statement_union_type **stmt; |
486 | lang_statement_union_type **stmt; |
468 | lang_output_section_statement_type **os_tail; |
487 | lang_output_section_statement_type **os_tail; |
469 | }; |
488 | }; |
Line -... | Line 489... | ||
- | 489 | ||
- | 490 | struct asneeded_minfo |
|
- | 491 | { |
|
- | 492 | struct asneeded_minfo *next; |
|
- | 493 | const char *soname; |
|
- | 494 | bfd *ref; |
|
- | 495 | const char *name; |
|
- | 496 | }; |
|
470 | 497 | ||
471 | extern struct lang_phdr *lang_phdr_list; |
498 | extern struct lang_phdr *lang_phdr_list; |
472 | extern struct lang_nocrossrefs *nocrossref_list; |
499 | extern struct lang_nocrossrefs *nocrossref_list; |
473 | extern const char *output_target; |
500 | extern const char *output_target; |
474 | extern lang_output_section_statement_type *abs_output_section; |
501 | extern lang_output_section_statement_type *abs_output_section; |
475 | extern lang_statement_list_type lang_output_section_statement; |
502 | extern lang_statement_list_type lang_output_section_statement; |
476 | extern struct lang_input_statement_flags input_flags; |
503 | extern struct lang_input_statement_flags input_flags; |
477 | extern bfd_boolean lang_has_input_file; |
- | |
478 | extern etree_type *base; |
504 | extern bfd_boolean lang_has_input_file; |
479 | extern lang_statement_list_type *stat_ptr; |
505 | extern lang_statement_list_type *stat_ptr; |
Line 480... | Line 506... | ||
480 | extern bfd_boolean delete_output_file_on_failure; |
506 | extern bfd_boolean delete_output_file_on_failure; |
481 | 507 | ||
482 | extern struct bfd_sym_chain entry_symbol; |
508 | extern struct bfd_sym_chain entry_symbol; |
483 | extern const char *entry_section; |
509 | extern const char *entry_section; |
484 | extern bfd_boolean entry_from_cmdline; |
510 | extern bfd_boolean entry_from_cmdline; |
Line 485... | Line 511... | ||
485 | extern lang_statement_list_type file_chain; |
511 | extern lang_statement_list_type file_chain; |
- | 512 | extern lang_statement_list_type input_file_chain; |
|
- | 513 | ||
- | 514 | extern int lang_statement_iteration; |
|
Line 486... | Line 515... | ||
486 | extern lang_statement_list_type input_file_chain; |
515 | extern struct asneeded_minfo **asneeded_list_tail; |
487 | 516 | ||
488 | extern int lang_statement_iteration; |
517 | extern void (*output_bfd_hash_table_free_fn) (struct bfd_link_hash_table *); |
489 | 518 | ||
Line 561... | Line 590... | ||
561 | extern void lang_process |
590 | extern void lang_process |
562 | (void); |
591 | (void); |
563 | extern void ldlang_add_file |
592 | extern void ldlang_add_file |
564 | (lang_input_statement_type *); |
593 | (lang_input_statement_type *); |
565 | extern lang_output_section_statement_type *lang_output_section_find_by_flags |
594 | extern lang_output_section_statement_type *lang_output_section_find_by_flags |
566 | (const asection *, lang_output_section_statement_type **, |
595 | (const asection *, flagword, lang_output_section_statement_type **, |
567 | lang_match_sec_type_func); |
596 | lang_match_sec_type_func); |
568 | extern lang_output_section_statement_type *lang_insert_orphan |
597 | extern lang_output_section_statement_type *lang_insert_orphan |
569 | (asection *, const char *, int, lang_output_section_statement_type *, |
598 | (asection *, const char *, int, lang_output_section_statement_type *, |
570 | struct orphan_save *, etree_type *, lang_statement_list_type *); |
599 | struct orphan_save *, etree_type *, lang_statement_list_type *); |
571 | extern lang_input_statement_type *lang_add_input_file |
600 | extern lang_input_statement_type *lang_add_input_file |
572 | (const char *, lang_input_file_enum_type, const char *); |
601 | (const char *, lang_input_file_enum_type, const char *); |
573 | extern void lang_add_keepsyms_file |
602 | extern void lang_add_keepsyms_file |
574 | (const char *); |
603 | (const char *); |
- | 604 | extern lang_output_section_statement_type *lang_output_section_get |
|
- | 605 | (const asection *); |
|
575 | extern lang_output_section_statement_type *lang_output_section_statement_lookup |
606 | extern lang_output_section_statement_type *lang_output_section_statement_lookup |
576 | (const char *, int, bfd_boolean); |
607 | (const char *, int, bfd_boolean); |
577 | extern lang_output_section_statement_type *next_matching_output_section_statement |
608 | extern lang_output_section_statement_type *next_matching_output_section_statement |
578 | (lang_output_section_statement_type *, int); |
609 | (lang_output_section_statement_type *, int); |
579 | extern void ldlang_add_undef |
610 | extern void ldlang_add_undef |
580 | (const char *const, bfd_boolean); |
611 | (const char *const, bfd_boolean); |
- | 612 | extern void ldlang_add_require_defined |
|
- | 613 | (const char *const); |
|
581 | extern void lang_add_output_format |
614 | extern void lang_add_output_format |
582 | (const char *, const char *, const char *, int); |
615 | (const char *, const char *, const char *, int); |
583 | extern void lang_list_init |
616 | extern void lang_list_init |
584 | (lang_statement_list_type *); |
617 | (lang_statement_list_type *); |
585 | extern void push_stat_ptr |
618 | extern void push_stat_ptr |
Line 597... | Line 630... | ||
597 | (void (*) (lang_statement_union_type *), lang_statement_union_type *); |
630 | (void (*) (lang_statement_union_type *), lang_statement_union_type *); |
598 | extern void *stat_alloc |
631 | extern void *stat_alloc |
599 | (size_t); |
632 | (size_t); |
600 | extern void strip_excluded_output_sections |
633 | extern void strip_excluded_output_sections |
601 | (void); |
634 | (void); |
- | 635 | extern void lang_clear_os_map |
|
- | 636 | (void); |
|
602 | extern void dprint_statement |
637 | extern void dprint_statement |
603 | (lang_statement_union_type *, int); |
638 | (lang_statement_union_type *, int); |
604 | extern void lang_size_sections |
639 | extern void lang_size_sections |
605 | (bfd_boolean *, bfd_boolean); |
640 | (bfd_boolean *, bfd_boolean); |
606 | extern void one_lang_size_sections_pass |
641 | extern void one_lang_size_sections_pass |
Line 642... | Line 677... | ||
642 | extern void lang_append_dynamic_list_cpp_new (void); |
677 | extern void lang_append_dynamic_list_cpp_new (void); |
643 | extern void lang_add_unique |
678 | extern void lang_add_unique |
644 | (const char *); |
679 | (const char *); |
645 | extern const char *lang_get_output_target |
680 | extern const char *lang_get_output_target |
646 | (void); |
681 | (void); |
647 | extern void lang_track_definedness (const char *); |
- | |
648 | extern int lang_symbol_definition_iteration (const char *); |
- | |
649 | extern void lang_update_definedness |
- | |
650 | (const char *, struct bfd_link_hash_entry *); |
- | |
651 | - | ||
652 | extern void add_excluded_libs (const char *); |
682 | extern void add_excluded_libs (const char *); |
653 | extern bfd_boolean load_symbols |
683 | extern bfd_boolean load_symbols |
654 | (lang_input_statement_type *, lang_statement_list_type *); |
684 | (lang_input_statement_type *, lang_statement_list_type *); |
Line 655... | Line 685... | ||
655 | 685 | ||
Line 658... | Line 688... | ||
658 | (struct bfd_link_info *, bfd *, asection *, asection *, bfd_boolean); |
688 | (struct bfd_link_info *, bfd *, asection *, asection *, bfd_boolean); |
Line 659... | Line 689... | ||
659 | 689 | ||
660 | extern void |
690 | extern void |
Line -... | Line 691... | ||
- | 691 | lang_ld_feature (char *); |
|
- | 692 | ||
- | 693 | extern void |
|
661 | lang_ld_feature (char *); |
694 | lang_print_memory_usage (void); |