[binutils-gdb] linker bfd.h tidy

Alan Modra amodra@sourceware.org
Mon Sep 23 00:59:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=640197ac27920a9f0a23283a575dc71f74e8b8ab

commit 640197ac27920a9f0a23283a575dc71f74e8b8ab
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Sep 23 10:14:20 2019 +0930

    linker bfd.h tidy
    
    bfd/
    	* bfd-in.h (bfd_symbol, bfd_section_already_linked),
    	(bfd_elf_version_tree): Delete forward declarations.
    	Move other forward decls and remaining elf function decl later.
    	(bfd_section_already_linked_table_init),
    	(bfd_section_already_linked_table_free),
    	(_bfd_handle_already_linked, _bfd_nearby_section),
    	(_bfd_fix_excluded_sec_syms): Move to bfdlink.h.
    include/
    	* bfdlink.h (struct bfd_section_already_linked): Forward declare.
    	(bfd_section_already_linked_table_init),
    	(bfd_section_already_linked_table_free),
    	(_bfd_handle_already_linked, _bfd_nearby_section),
    	(_bfd_fix_excluded_sec_syms): Declare.

Diff:
---
 bfd/ChangeLog     | 10 ++++++++
 bfd/bfd-in.h      | 71 ++++++++++++++++++++++---------------------------------
 bfd/bfd-in2.h     | 71 ++++++++++++++++++++++---------------------------------
 include/ChangeLog |  8 +++++++
 include/bfdlink.h | 14 +++++++++++
 5 files changed, 88 insertions(+), 86 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 923adb4..4354474 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,15 @@
 2019-09-23  Alan Modra  <amodra@gmail.com>
 
+	* bfd-in.h (bfd_symbol, bfd_section_already_linked),
+	(bfd_elf_version_tree): Delete forward declarations.
+	Move other forward decls and remaining elf function decl later.
+	(bfd_section_already_linked_table_init),
+	(bfd_section_already_linked_table_free),
+	(_bfd_handle_already_linked, _bfd_nearby_section),
+	(_bfd_fix_excluded_sec_syms): Move to bfdlink.h.
+
+2019-09-23  Alan Modra  <amodra@gmail.com>
+
 	* bfd-in.h: Move ecoff function declarations..
 	* ecoff-bfd.h: ..to here, new file.
 	* ecoff.c: Include ecoff-bfd.h.
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 4d2f09f..d81cbb7 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -509,49 +509,6 @@ void bfd_putl16 (bfd_vma, void *);
 bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
 void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
 
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct bfd_symbol;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
-struct bfd_section_already_linked;
-struct bfd_elf_version_tree;
-#endif
-
-extern bfd_boolean bfd_section_already_linked_table_init (void);
-extern void bfd_section_already_linked_table_free (void);
-extern bfd_boolean _bfd_handle_already_linked
-  (struct bfd_section *, struct bfd_section_already_linked *,
-   struct bfd_link_info *);
-
-/* Externally visible ELF routines.  */
-
-/* Create a new BFD as if by bfd_openr.  Rather than opening a file,
-   reconstruct an ELF file by reading the segments out of remote
-   memory based on the ELF file header at EHDR_VMA and the ELF program
-   headers it points to.  If non-zero, SIZE is the known extent of the
-   object.  If not null, *LOADBASEP is filled in with the difference
-   between the VMAs from which the segments were read, and the VMAs
-   the file headers (and hence BFD's idea of each section's VMA) put
-   them at.
-
-   The function TARGET_READ_MEMORY is called to copy LEN bytes from
-   the remote memory at target address VMA into the local buffer at
-   MYADDR; it should return zero on success or an `errno' code on
-   failure.  TEMPL must be a BFD for a target with the word size and
-   byte order found in the remote memory.  */
-extern bfd *bfd_elf_bfd_from_remote_memory
-  (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
-   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
-			      bfd_size_type len));
-
-extern struct bfd_section *
-_bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
-
-extern void _bfd_fix_excluded_sec_syms
-  (bfd *, struct bfd_link_info *);
 
 /* mmap hacks */
 
@@ -579,3 +536,31 @@ extern void bfd_free_window
   (bfd_window *);
 extern bfd_boolean bfd_get_file_window
   (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
+
+/* Externally visible ELF routines.  */
+
+/* Create a new BFD as if by bfd_openr.  Rather than opening a file,
+   reconstruct an ELF file by reading the segments out of remote
+   memory based on the ELF file header at EHDR_VMA and the ELF program
+   headers it points to.  If non-zero, SIZE is the known extent of the
+   object.  If not null, *LOADBASEP is filled in with the difference
+   between the VMAs from which the segments were read, and the VMAs
+   the file headers (and hence BFD's idea of each section's VMA) put
+   them at.
+
+   The function TARGET_READ_MEMORY is called to copy LEN bytes from
+   the remote memory at target address VMA into the local buffer at
+   MYADDR; it should return zero on success or an `errno' code on
+   failure.  TEMPL must be a BFD for a target with the word size and
+   byte order found in the remote memory.  */
+extern bfd *bfd_elf_bfd_from_remote_memory
+  (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
+   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
+			      bfd_size_type len));
+
+/* Forward declarations.  */
+struct ecoff_debug_info;
+struct ecoff_debug_swap;
+struct ecoff_extr;
+struct bfd_link_info;
+struct bfd_link_hash_entry;
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 16fa462..1c468dc 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -516,49 +516,6 @@ void bfd_putl16 (bfd_vma, void *);
 bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
 void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
 
-#if defined(__STDC__) || defined(ALMOST_STDC)
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct bfd_symbol;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
-struct bfd_section_already_linked;
-struct bfd_elf_version_tree;
-#endif
-
-extern bfd_boolean bfd_section_already_linked_table_init (void);
-extern void bfd_section_already_linked_table_free (void);
-extern bfd_boolean _bfd_handle_already_linked
-  (struct bfd_section *, struct bfd_section_already_linked *,
-   struct bfd_link_info *);
-
-/* Externally visible ELF routines.  */
-
-/* Create a new BFD as if by bfd_openr.  Rather than opening a file,
-   reconstruct an ELF file by reading the segments out of remote
-   memory based on the ELF file header at EHDR_VMA and the ELF program
-   headers it points to.  If non-zero, SIZE is the known extent of the
-   object.  If not null, *LOADBASEP is filled in with the difference
-   between the VMAs from which the segments were read, and the VMAs
-   the file headers (and hence BFD's idea of each section's VMA) put
-   them at.
-
-   The function TARGET_READ_MEMORY is called to copy LEN bytes from
-   the remote memory at target address VMA into the local buffer at
-   MYADDR; it should return zero on success or an `errno' code on
-   failure.  TEMPL must be a BFD for a target with the word size and
-   byte order found in the remote memory.  */
-extern bfd *bfd_elf_bfd_from_remote_memory
-  (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
-   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
-			      bfd_size_type len));
-
-extern struct bfd_section *
-_bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
-
-extern void _bfd_fix_excluded_sec_syms
-  (bfd *, struct bfd_link_info *);
 
 /* mmap hacks */
 
@@ -586,6 +543,34 @@ extern void bfd_free_window
   (bfd_window *);
 extern bfd_boolean bfd_get_file_window
   (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
+
+/* Externally visible ELF routines.  */
+
+/* Create a new BFD as if by bfd_openr.  Rather than opening a file,
+   reconstruct an ELF file by reading the segments out of remote
+   memory based on the ELF file header at EHDR_VMA and the ELF program
+   headers it points to.  If non-zero, SIZE is the known extent of the
+   object.  If not null, *LOADBASEP is filled in with the difference
+   between the VMAs from which the segments were read, and the VMAs
+   the file headers (and hence BFD's idea of each section's VMA) put
+   them at.
+
+   The function TARGET_READ_MEMORY is called to copy LEN bytes from
+   the remote memory at target address VMA into the local buffer at
+   MYADDR; it should return zero on success or an `errno' code on
+   failure.  TEMPL must be a BFD for a target with the word size and
+   byte order found in the remote memory.  */
+extern bfd *bfd_elf_bfd_from_remote_memory
+  (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
+   int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
+			      bfd_size_type len));
+
+/* Forward declarations.  */
+struct ecoff_debug_info;
+struct ecoff_debug_swap;
+struct ecoff_extr;
+struct bfd_link_info;
+struct bfd_link_hash_entry;
 /* Extracted from init.c.  */
 unsigned int bfd_init (void);
 
diff --git a/include/ChangeLog b/include/ChangeLog
index 580eeb0..8540542 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,5 +1,13 @@
 2019-09-23  Alan Modra  <amodra@gmail.com>
 
+	* bfdlink.h (struct bfd_section_already_linked): Forward declare.
+	(bfd_section_already_linked_table_init),
+	(bfd_section_already_linked_table_free),
+	(_bfd_handle_already_linked, _bfd_nearby_section),
+	(_bfd_fix_excluded_sec_syms): Declare.
+
+2019-09-23  Alan Modra  <amodra@gmail.com>
+
 	* bfdlink.h (enum notice_asneeded_action): Define.
 
 2019-09-17  Maxim Blinov  <maxim.blinov@embecosm.com>
diff --git a/include/bfdlink.h b/include/bfdlink.h
index bb7909a..68fc17f 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -858,6 +858,20 @@ struct bfd_link_order_reloc
 /* Allocate a new link_order for a section.  */
 extern struct bfd_link_order *bfd_new_link_order (bfd *, asection *);
 
+struct bfd_section_already_linked;
+
+extern bfd_boolean bfd_section_already_linked_table_init (void);
+extern void bfd_section_already_linked_table_free (void);
+extern bfd_boolean _bfd_handle_already_linked
+  (struct bfd_section *, struct bfd_section_already_linked *,
+   struct bfd_link_info *);
+
+extern struct bfd_section *_bfd_nearby_section
+  (bfd *, struct bfd_section *, bfd_vma);
+
+extern void _bfd_fix_excluded_sec_syms
+  (bfd *, struct bfd_link_info *);
+
 /* These structures are used to describe version information for the
    ELF linker.  These structures could be manipulated entirely inside
    BFD, but it would be a pain.  Instead, the regular linker sets up



More information about the Binutils-cvs mailing list