GNU Binutils with patches for OS216
修訂 | 0b4453c791106ab62011b59f97611f9ff21cda9f (tree) |
---|---|
時間 | 2019-09-23 09:57:22 |
作者 | Alan Modra <amodra@gmai...> |
Commiter | Alan Modra |
elf bfd.h tidy
bfd/
* bfd-in.h (enum notice_asneeded_action): Move to bfdlink.h.
Move most other elf declarations..
* elf-bfd.h: ..to here.
* bfd-in2.h: Regenerate.
include/
* bfdlink.h (enum notice_asneeded_action): Define.
ld/
* deffilep.y: Include bfdlink.h.
* ldelf.c: Likewise.
* ldelfgen.c: Likewise.
* ldver.c: Likewise.
* mri.c: Likewise.
* emultempl/irix.em: Don't include ld.h, ldmain.h, libiberty.h.
Comment.
@@ -1,5 +1,12 @@ | ||
1 | 1 | 2019-09-23 Alan Modra <amodra@gmail.com> |
2 | 2 | |
3 | + * bfd-in.h (enum notice_asneeded_action): Move to bfdlink.h. | |
4 | + Move most other elf declarations.. | |
5 | + * elf-bfd.h: ..to here. | |
6 | + * bfd-in2.h: Regenerate. | |
7 | + | |
8 | +2019-09-23 Alan Modra <amodra@gmail.com> | |
9 | + | |
3 | 10 | * bfd-in.h: Move m68k function declaration.. |
4 | 11 | * cpu-m68k.h: ..to here, new file.. |
5 | 12 | * elf32-m68k.h: ..and here, new file. |
@@ -570,72 +570,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug | ||
570 | 570 | |
571 | 571 | /* Externally visible ELF routines. */ |
572 | 572 | |
573 | -struct bfd_link_needed_list | |
574 | -{ | |
575 | - struct bfd_link_needed_list *next; | |
576 | - bfd *by; | |
577 | - const char *name; | |
578 | -}; | |
579 | - | |
580 | -enum dynamic_lib_link_class { | |
581 | - DYN_NORMAL = 0, | |
582 | - DYN_AS_NEEDED = 1, | |
583 | - DYN_DT_NEEDED = 2, | |
584 | - DYN_NO_ADD_NEEDED = 4, | |
585 | - DYN_NO_NEEDED = 8 | |
586 | -}; | |
587 | - | |
588 | -enum notice_asneeded_action { | |
589 | - notice_as_needed, | |
590 | - notice_not_needed, | |
591 | - notice_needed | |
592 | -}; | |
593 | - | |
594 | -extern bfd_boolean bfd_elf_record_link_assignment | |
595 | - (bfd *, struct bfd_link_info *, const char *, bfd_boolean, | |
596 | - bfd_boolean); | |
597 | -extern struct bfd_link_needed_list *bfd_elf_get_needed_list | |
598 | - (bfd *, struct bfd_link_info *); | |
599 | -extern bfd_boolean bfd_elf_get_bfd_needed_list | |
600 | - (bfd *, struct bfd_link_needed_list **); | |
601 | -extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, | |
602 | - const char *, bfd_vma); | |
603 | -extern bfd_boolean bfd_elf_size_dynamic_sections | |
604 | - (bfd *, const char *, const char *, const char *, const char *, const char *, | |
605 | - const char * const *, struct bfd_link_info *, struct bfd_section **); | |
606 | -extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr | |
607 | - (bfd *, struct bfd_link_info *); | |
608 | -extern void bfd_elf_set_dt_needed_name | |
609 | - (bfd *, const char *); | |
610 | -extern const char *bfd_elf_get_dt_soname | |
611 | - (bfd *); | |
612 | -extern void bfd_elf_set_dyn_lib_class | |
613 | - (bfd *, enum dynamic_lib_link_class); | |
614 | -extern int bfd_elf_get_dyn_lib_class | |
615 | - (bfd *); | |
616 | -extern struct bfd_link_needed_list *bfd_elf_get_runpath_list | |
617 | - (bfd *, struct bfd_link_info *); | |
618 | -extern int bfd_elf_discard_info | |
619 | - (bfd *, struct bfd_link_info *); | |
620 | -extern unsigned int _bfd_elf_default_action_discarded | |
621 | - (struct bfd_section *); | |
622 | - | |
623 | -/* Return an upper bound on the number of bytes required to store a | |
624 | - copy of ABFD's program header table entries. Return -1 if an error | |
625 | - occurs; bfd_get_error will return an appropriate code. */ | |
626 | -extern long bfd_get_elf_phdr_upper_bound | |
627 | - (bfd *abfd); | |
628 | - | |
629 | -/* Copy ABFD's program header table entries to *PHDRS. The entries | |
630 | - will be stored as an array of Elf_Internal_Phdr structures, as | |
631 | - defined in include/elf/internal.h. To find out how large the | |
632 | - buffer needs to be, call bfd_get_elf_phdr_upper_bound. | |
633 | - | |
634 | - Return the number of program header table entries read, or -1 if an | |
635 | - error occurs; bfd_get_error will return an appropriate code. */ | |
636 | -extern int bfd_get_elf_phdrs | |
637 | - (bfd *abfd, void *phdrs); | |
638 | - | |
639 | 573 | /* Create a new BFD as if by bfd_openr. Rather than opening a file, |
640 | 574 | reconstruct an ELF file by reading the segments out of remote |
641 | 575 | memory based on the ELF file header at EHDR_VMA and the ELF program |
@@ -655,9 +589,6 @@ extern bfd *bfd_elf_bfd_from_remote_memory | ||
655 | 589 | int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
656 | 590 | bfd_size_type len)); |
657 | 591 | |
658 | -extern struct bfd_section *_bfd_elf_tls_setup | |
659 | - (bfd *, struct bfd_link_info *); | |
660 | - | |
661 | 592 | extern struct bfd_section * |
662 | 593 | _bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma); |
663 | 594 |
@@ -577,72 +577,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug | ||
577 | 577 | |
578 | 578 | /* Externally visible ELF routines. */ |
579 | 579 | |
580 | -struct bfd_link_needed_list | |
581 | -{ | |
582 | - struct bfd_link_needed_list *next; | |
583 | - bfd *by; | |
584 | - const char *name; | |
585 | -}; | |
586 | - | |
587 | -enum dynamic_lib_link_class { | |
588 | - DYN_NORMAL = 0, | |
589 | - DYN_AS_NEEDED = 1, | |
590 | - DYN_DT_NEEDED = 2, | |
591 | - DYN_NO_ADD_NEEDED = 4, | |
592 | - DYN_NO_NEEDED = 8 | |
593 | -}; | |
594 | - | |
595 | -enum notice_asneeded_action { | |
596 | - notice_as_needed, | |
597 | - notice_not_needed, | |
598 | - notice_needed | |
599 | -}; | |
600 | - | |
601 | -extern bfd_boolean bfd_elf_record_link_assignment | |
602 | - (bfd *, struct bfd_link_info *, const char *, bfd_boolean, | |
603 | - bfd_boolean); | |
604 | -extern struct bfd_link_needed_list *bfd_elf_get_needed_list | |
605 | - (bfd *, struct bfd_link_info *); | |
606 | -extern bfd_boolean bfd_elf_get_bfd_needed_list | |
607 | - (bfd *, struct bfd_link_needed_list **); | |
608 | -extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, | |
609 | - const char *, bfd_vma); | |
610 | -extern bfd_boolean bfd_elf_size_dynamic_sections | |
611 | - (bfd *, const char *, const char *, const char *, const char *, const char *, | |
612 | - const char * const *, struct bfd_link_info *, struct bfd_section **); | |
613 | -extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr | |
614 | - (bfd *, struct bfd_link_info *); | |
615 | -extern void bfd_elf_set_dt_needed_name | |
616 | - (bfd *, const char *); | |
617 | -extern const char *bfd_elf_get_dt_soname | |
618 | - (bfd *); | |
619 | -extern void bfd_elf_set_dyn_lib_class | |
620 | - (bfd *, enum dynamic_lib_link_class); | |
621 | -extern int bfd_elf_get_dyn_lib_class | |
622 | - (bfd *); | |
623 | -extern struct bfd_link_needed_list *bfd_elf_get_runpath_list | |
624 | - (bfd *, struct bfd_link_info *); | |
625 | -extern int bfd_elf_discard_info | |
626 | - (bfd *, struct bfd_link_info *); | |
627 | -extern unsigned int _bfd_elf_default_action_discarded | |
628 | - (struct bfd_section *); | |
629 | - | |
630 | -/* Return an upper bound on the number of bytes required to store a | |
631 | - copy of ABFD's program header table entries. Return -1 if an error | |
632 | - occurs; bfd_get_error will return an appropriate code. */ | |
633 | -extern long bfd_get_elf_phdr_upper_bound | |
634 | - (bfd *abfd); | |
635 | - | |
636 | -/* Copy ABFD's program header table entries to *PHDRS. The entries | |
637 | - will be stored as an array of Elf_Internal_Phdr structures, as | |
638 | - defined in include/elf/internal.h. To find out how large the | |
639 | - buffer needs to be, call bfd_get_elf_phdr_upper_bound. | |
640 | - | |
641 | - Return the number of program header table entries read, or -1 if an | |
642 | - error occurs; bfd_get_error will return an appropriate code. */ | |
643 | -extern int bfd_get_elf_phdrs | |
644 | - (bfd *abfd, void *phdrs); | |
645 | - | |
646 | 580 | /* Create a new BFD as if by bfd_openr. Rather than opening a file, |
647 | 581 | reconstruct an ELF file by reading the segments out of remote |
648 | 582 | memory based on the ELF file header at EHDR_VMA and the ELF program |
@@ -662,9 +596,6 @@ extern bfd *bfd_elf_bfd_from_remote_memory | ||
662 | 596 | int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
663 | 597 | bfd_size_type len)); |
664 | 598 | |
665 | -extern struct bfd_section *_bfd_elf_tls_setup | |
666 | - (bfd *, struct bfd_link_info *); | |
667 | - | |
668 | 599 | extern struct bfd_section * |
669 | 600 | _bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma); |
670 | 601 |
@@ -529,6 +529,13 @@ struct elf_sym_strtab | ||
529 | 529 | unsigned long destshndx_index; |
530 | 530 | }; |
531 | 531 | |
532 | +struct bfd_link_needed_list | |
533 | +{ | |
534 | + struct bfd_link_needed_list *next; | |
535 | + bfd *by; | |
536 | + const char *name; | |
537 | +}; | |
538 | + | |
532 | 539 | /* ELF linker hash table. */ |
533 | 540 | |
534 | 541 | struct elf_link_hash_table |
@@ -1828,6 +1835,14 @@ typedef struct elf_section_list | ||
1828 | 1835 | struct elf_section_list * next; |
1829 | 1836 | } elf_section_list; |
1830 | 1837 | |
1838 | +enum dynamic_lib_link_class { | |
1839 | + DYN_NORMAL = 0, | |
1840 | + DYN_AS_NEEDED = 1, | |
1841 | + DYN_DT_NEEDED = 2, | |
1842 | + DYN_NO_ADD_NEEDED = 4, | |
1843 | + DYN_NO_NEEDED = 8 | |
1844 | +}; | |
1845 | + | |
1831 | 1846 | /* Some private data is stashed away for future use using the tdata pointer |
1832 | 1847 | in the bfd structure. */ |
1833 | 1848 |
@@ -2287,6 +2302,37 @@ extern file_ptr _bfd_elf_assign_file_position_for_section | ||
2287 | 2302 | extern bfd_boolean _bfd_elf_validate_reloc |
2288 | 2303 | (bfd *, arelent *); |
2289 | 2304 | |
2305 | +extern bfd_boolean bfd_elf_record_link_assignment | |
2306 | + (bfd *, struct bfd_link_info *, const char *, bfd_boolean, | |
2307 | + bfd_boolean); | |
2308 | +extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, | |
2309 | + const char *, bfd_vma); | |
2310 | +extern bfd_boolean bfd_elf_size_dynamic_sections | |
2311 | + (bfd *, const char *, const char *, const char *, const char *, const char *, | |
2312 | + const char * const *, struct bfd_link_info *, struct bfd_section **); | |
2313 | +extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr | |
2314 | + (bfd *, struct bfd_link_info *); | |
2315 | +extern bfd_boolean bfd_elf_get_bfd_needed_list | |
2316 | + (bfd *, struct bfd_link_needed_list **); | |
2317 | +extern struct bfd_link_needed_list *bfd_elf_get_needed_list | |
2318 | + (bfd *, struct bfd_link_info *); | |
2319 | +extern void bfd_elf_set_dt_needed_name | |
2320 | + (bfd *, const char *); | |
2321 | +extern const char *bfd_elf_get_dt_soname | |
2322 | + (bfd *); | |
2323 | +extern void bfd_elf_set_dyn_lib_class | |
2324 | + (bfd *, enum dynamic_lib_link_class); | |
2325 | +extern int bfd_elf_get_dyn_lib_class | |
2326 | + (bfd *); | |
2327 | +extern struct bfd_link_needed_list *bfd_elf_get_runpath_list | |
2328 | + (bfd *, struct bfd_link_info *); | |
2329 | +extern int bfd_elf_discard_info | |
2330 | + (bfd *, struct bfd_link_info *); | |
2331 | +extern unsigned int _bfd_elf_default_action_discarded | |
2332 | + (struct bfd_section *); | |
2333 | +extern struct bfd_section *_bfd_elf_tls_setup | |
2334 | + (bfd *, struct bfd_link_info *); | |
2335 | + | |
2290 | 2336 | extern bfd_boolean _bfd_elf_link_create_dynamic_sections |
2291 | 2337 | (bfd *, struct bfd_link_info *); |
2292 | 2338 | extern bfd_boolean _bfd_elf_omit_section_dynsym_default |
@@ -2557,6 +2603,22 @@ extern bfd_boolean _bfd_elf_ppc_set_arch (bfd *); | ||
2557 | 2603 | extern bfd_boolean _bfd_elf_ppc_merge_fp_attributes |
2558 | 2604 | (bfd *, struct bfd_link_info *); |
2559 | 2605 | |
2606 | +/* Return an upper bound on the number of bytes required to store a | |
2607 | + copy of ABFD's program header table entries. Return -1 if an error | |
2608 | + occurs; bfd_get_error will return an appropriate code. */ | |
2609 | +extern long bfd_get_elf_phdr_upper_bound | |
2610 | + (bfd *abfd); | |
2611 | + | |
2612 | +/* Copy ABFD's program header table entries to *PHDRS. The entries | |
2613 | + will be stored as an array of Elf_Internal_Phdr structures, as | |
2614 | + defined in include/elf/internal.h. To find out how large the | |
2615 | + buffer needs to be, call bfd_get_elf_phdr_upper_bound. | |
2616 | + | |
2617 | + Return the number of program header table entries read, or -1 if an | |
2618 | + error occurs; bfd_get_error will return an appropriate code. */ | |
2619 | +extern int bfd_get_elf_phdrs | |
2620 | + (bfd *abfd, void *phdrs); | |
2621 | + | |
2560 | 2622 | /* Exported interface for writing elf corefile notes. */ |
2561 | 2623 | extern char *elfcore_write_note |
2562 | 2624 | (bfd *, char *, int *, const char *, int, const void *, int); |
@@ -1,3 +1,7 @@ | ||
1 | +2019-09-23 Alan Modra <amodra@gmail.com> | |
2 | + | |
3 | + * bfdlink.h (enum notice_asneeded_action): Define. | |
4 | + | |
1 | 5 | 2019-09-17 Maxim Blinov <maxim.blinov@embecosm.com> |
2 | 6 | |
3 | 7 | * opcode/riscv.h (riscv_insn_class): New enum. |
@@ -42,6 +42,12 @@ enum bfd_link_discard | ||
42 | 42 | discard_all /* Discard all locals. */ |
43 | 43 | }; |
44 | 44 | |
45 | +enum notice_asneeded_action { | |
46 | + notice_as_needed, | |
47 | + notice_not_needed, | |
48 | + notice_needed | |
49 | +}; | |
50 | + | |
45 | 51 | /* Whether to generate ELF common symbols with the STT_COMMON type |
46 | 52 | during a relocatable link. */ |
47 | 53 | enum bfd_link_elf_stt_common |
@@ -1,5 +1,15 @@ | ||
1 | 1 | 2019-09-23 Alan Modra <amodra@gmail.com> |
2 | 2 | |
3 | + * deffilep.y: Include bfdlink.h. | |
4 | + * ldelf.c: Likewise. | |
5 | + * ldelfgen.c: Likewise. | |
6 | + * ldver.c: Likewise. | |
7 | + * mri.c: Likewise. | |
8 | + * emultempl/irix.em: Don't include ld.h, ldmain.h, libiberty.h. | |
9 | + Comment. | |
10 | + | |
11 | +2019-09-23 Alan Modra <amodra@gmail.com> | |
12 | + | |
3 | 13 | * emultempl/m68kelf.em: Include elf32-m68k.h. |
4 | 14 | |
5 | 15 | 2019-09-23 Alan Modra <amodra@gmail.com> |
@@ -23,6 +23,7 @@ | ||
23 | 23 | #include "libiberty.h" |
24 | 24 | #include "safe-ctype.h" |
25 | 25 | #include "bfd.h" |
26 | +#include "bfdlink.h" | |
26 | 27 | #include "ld.h" |
27 | 28 | #include "ldmisc.h" |
28 | 29 | #include "deffile.h" |
@@ -19,11 +19,10 @@ | ||
19 | 19 | # MA 02110-1301, USA. |
20 | 20 | # |
21 | 21 | |
22 | -fragment <<EOF | |
22 | +# This file is sourced from elf.em, and defines extra irix specific | |
23 | +# functions. | |
23 | 24 | |
24 | -#include "ld.h" | |
25 | -#include "ldmain.h" | |
26 | -#include "libiberty.h" | |
25 | +fragment <<EOF | |
27 | 26 | |
28 | 27 | /* The native IRIX linker will always create a DT_SONAME for shared objects. |
29 | 28 | While this shouldn't really be necessary for ABI conformance, some versions |
@@ -23,6 +23,7 @@ | ||
23 | 23 | #include "libiberty.h" |
24 | 24 | #include "filenames.h" |
25 | 25 | #include "safe-ctype.h" |
26 | +#include "bfdlink.h" | |
26 | 27 | #include "ld.h" |
27 | 28 | #include "ldmain.h" |
28 | 29 | #include "ldmisc.h" |
@@ -20,6 +20,7 @@ | ||
20 | 20 | |
21 | 21 | #include "sysdep.h" |
22 | 22 | #include "bfd.h" |
23 | +#include "bfdlink.h" | |
23 | 24 | #include "ld.h" |
24 | 25 | #include "ldmain.h" |
25 | 26 | #include "ldmisc.h" |
@@ -21,7 +21,7 @@ | ||
21 | 21 | #include "sysdep.h" |
22 | 22 | #include "bfd.h" |
23 | 23 | #include "bfdver.h" |
24 | - | |
24 | +#include "bfdlink.h" | |
25 | 25 | #include "ld.h" |
26 | 26 | #include "ldver.h" |
27 | 27 | #include "ldexp.h" |
@@ -25,6 +25,7 @@ | ||
25 | 25 | |
26 | 26 | #include "sysdep.h" |
27 | 27 | #include "bfd.h" |
28 | +#include "bfdlink.h" | |
28 | 29 | #include "ld.h" |
29 | 30 | #include "ldexp.h" |
30 | 31 | #include "ldlang.h" |