• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂0b4453c791106ab62011b59f97611f9ff21cda9f (tree)
時間2019-09-23 09:57:22
作者Alan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

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.

Change Summary

差異

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,12 @@
11 2019-09-23 Alan Modra <amodra@gmail.com>
22
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+
310 * bfd-in.h: Move m68k function declaration..
411 * cpu-m68k.h: ..to here, new file..
512 * elf32-m68k.h: ..and here, new file.
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -570,72 +570,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug
570570
571571 /* Externally visible ELF routines. */
572572
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-
639573 /* Create a new BFD as if by bfd_openr. Rather than opening a file,
640574 reconstruct an ELF file by reading the segments out of remote
641575 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
655589 int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
656590 bfd_size_type len));
657591
658-extern struct bfd_section *_bfd_elf_tls_setup
659- (bfd *, struct bfd_link_info *);
660-
661592 extern struct bfd_section *
662593 _bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
663594
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -577,72 +577,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug
577577
578578 /* Externally visible ELF routines. */
579579
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-
646580 /* Create a new BFD as if by bfd_openr. Rather than opening a file,
647581 reconstruct an ELF file by reading the segments out of remote
648582 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
662596 int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
663597 bfd_size_type len));
664598
665-extern struct bfd_section *_bfd_elf_tls_setup
666- (bfd *, struct bfd_link_info *);
667-
668599 extern struct bfd_section *
669600 _bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
670601
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -529,6 +529,13 @@ struct elf_sym_strtab
529529 unsigned long destshndx_index;
530530 };
531531
532+struct bfd_link_needed_list
533+{
534+ struct bfd_link_needed_list *next;
535+ bfd *by;
536+ const char *name;
537+};
538+
532539 /* ELF linker hash table. */
533540
534541 struct elf_link_hash_table
@@ -1828,6 +1835,14 @@ typedef struct elf_section_list
18281835 struct elf_section_list * next;
18291836 } elf_section_list;
18301837
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+
18311846 /* Some private data is stashed away for future use using the tdata pointer
18321847 in the bfd structure. */
18331848
@@ -2287,6 +2302,37 @@ extern file_ptr _bfd_elf_assign_file_position_for_section
22872302 extern bfd_boolean _bfd_elf_validate_reloc
22882303 (bfd *, arelent *);
22892304
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+
22902336 extern bfd_boolean _bfd_elf_link_create_dynamic_sections
22912337 (bfd *, struct bfd_link_info *);
22922338 extern bfd_boolean _bfd_elf_omit_section_dynsym_default
@@ -2557,6 +2603,22 @@ extern bfd_boolean _bfd_elf_ppc_set_arch (bfd *);
25572603 extern bfd_boolean _bfd_elf_ppc_merge_fp_attributes
25582604 (bfd *, struct bfd_link_info *);
25592605
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+
25602622 /* Exported interface for writing elf corefile notes. */
25612623 extern char *elfcore_write_note
25622624 (bfd *, char *, int *, const char *, int, const void *, int);
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
1+2019-09-23 Alan Modra <amodra@gmail.com>
2+
3+ * bfdlink.h (enum notice_asneeded_action): Define.
4+
15 2019-09-17 Maxim Blinov <maxim.blinov@embecosm.com>
26
37 * opcode/riscv.h (riscv_insn_class): New enum.
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -42,6 +42,12 @@ enum bfd_link_discard
4242 discard_all /* Discard all locals. */
4343 };
4444
45+enum notice_asneeded_action {
46+ notice_as_needed,
47+ notice_not_needed,
48+ notice_needed
49+};
50+
4551 /* Whether to generate ELF common symbols with the STT_COMMON type
4652 during a relocatable link. */
4753 enum bfd_link_elf_stt_common
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,15 @@
11 2019-09-23 Alan Modra <amodra@gmail.com>
22
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+
313 * emultempl/m68kelf.em: Include elf32-m68k.h.
414
515 2019-09-23 Alan Modra <amodra@gmail.com>
--- a/ld/deffilep.y
+++ b/ld/deffilep.y
@@ -23,6 +23,7 @@
2323 #include "libiberty.h"
2424 #include "safe-ctype.h"
2525 #include "bfd.h"
26+#include "bfdlink.h"
2627 #include "ld.h"
2728 #include "ldmisc.h"
2829 #include "deffile.h"
--- a/ld/emultempl/irix.em
+++ b/ld/emultempl/irix.em
@@ -19,11 +19,10 @@
1919 # MA 02110-1301, USA.
2020 #
2121
22-fragment <<EOF
22+# This file is sourced from elf.em, and defines extra irix specific
23+# functions.
2324
24-#include "ld.h"
25-#include "ldmain.h"
26-#include "libiberty.h"
25+fragment <<EOF
2726
2827 /* The native IRIX linker will always create a DT_SONAME for shared objects.
2928 While this shouldn't really be necessary for ABI conformance, some versions
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -23,6 +23,7 @@
2323 #include "libiberty.h"
2424 #include "filenames.h"
2525 #include "safe-ctype.h"
26+#include "bfdlink.h"
2627 #include "ld.h"
2728 #include "ldmain.h"
2829 #include "ldmisc.h"
--- a/ld/ldelfgen.c
+++ b/ld/ldelfgen.c
@@ -20,6 +20,7 @@
2020
2121 #include "sysdep.h"
2222 #include "bfd.h"
23+#include "bfdlink.h"
2324 #include "ld.h"
2425 #include "ldmain.h"
2526 #include "ldmisc.h"
--- a/ld/ldver.c
+++ b/ld/ldver.c
@@ -21,7 +21,7 @@
2121 #include "sysdep.h"
2222 #include "bfd.h"
2323 #include "bfdver.h"
24-
24+#include "bfdlink.h"
2525 #include "ld.h"
2626 #include "ldver.h"
2727 #include "ldexp.h"
--- a/ld/mri.c
+++ b/ld/mri.c
@@ -25,6 +25,7 @@
2525
2626 #include "sysdep.h"
2727 #include "bfd.h"
28+#include "bfdlink.h"
2829 #include "ld.h"
2930 #include "ldexp.h"
3031 #include "ldlang.h"