]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: Move bfd_init to bfd.c
authorAlan Modra <amodra@gmail.com>
Tue, 10 Jan 2023 09:58:18 +0000 (20:28 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 10 Jan 2023 10:12:24 +0000 (20:42 +1030)
Commit b1c95bc4dd73 resulted in
...bfd.texi:246: @include: could not find init.texi
which went unnoticed due to not building in a clean directory.

This fixes the problem by moving bfd_init earlier, giving it a
doc node, and stitching the nodes back together.

* bfd.c (bfd_init): Move earlier.  Give it a doc inode.
Adjust other inodes to suit.
* doc/bfd.texi: Don't include init.texi.  Adjust nodes to suit.

bfd/bfd-in2.h
bfd/bfd.c
bfd/doc/bfd.texi

index bb2b30200dc86fa4a904efef65f829571eab2cd0..b6e417f26ec6766989cc2bbcb859ec45318c9c94 100644 (file)
@@ -7105,6 +7105,11 @@ typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg,
 
 bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type);
 
+unsigned int bfd_init (void);
+
+/* Value returned by bfd_init.  */
+#define BFD_INIT_MAGIC (sizeof (struct bfd_section))
+
 long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
 
 long bfd_canonicalize_reloc
@@ -7256,11 +7261,6 @@ bfd_vma bfd_emul_get_commonpagesize (const char *);
 
 char *bfd_demangle (bfd *, const char *, int);
 
-unsigned int bfd_init (void);
-
-/* Value returned by bfd_init.  */
-#define BFD_INIT_MAGIC (sizeof (struct bfd_section))
-
 /* Extracted from archive.c.  */
 symindex bfd_get_next_mapent
    (bfd *abfd, symindex previous, carsym **sym);
index 1d1c44989384bd4ae0bc944d51fd6d3f2800a0bc..c59e31d99e209bd63be06c36cceefa4c7e91c7b0 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -643,7 +643,7 @@ CODE_FRAGMENT
 \f
 /*
 INODE
-Error reporting, Miscellaneous, typedef bfd, BFD front end
+Error reporting, Initialization, typedef bfd, BFD front end
 
 SECTION
        Error reporting
@@ -1628,10 +1628,44 @@ bfd_set_assert_handler (bfd_assert_handler_type pnew)
   _bfd_assert_handler = pnew;
   return pold;
 }
+
+/*
+INODE
+Initialization, Miscellaneous, Error reporting, BFD front end
+
+FUNCTION
+       bfd_init
+
+SYNOPSIS
+       unsigned int bfd_init (void);
+
+DESCRIPTION
+       This routine must be called before any other BFD function to
+       initialize magical internal data structures.
+       Returns a magic number, which may be used to check
+       that the bfd library is configured as expected by users.
+
+.{* Value returned by bfd_init.  *}
+.#define BFD_INIT_MAGIC (sizeof (struct bfd_section))
+.
+*/
+
+unsigned int
+bfd_init (void)
+{
+  bfd_error = bfd_error_no_error;
+  input_bfd = NULL;
+  input_error = bfd_error_no_error;
+  _bfd_error_program_name = NULL;
+  _bfd_error_internal = error_handler_fprintf;
+  _bfd_assert_handler = _bfd_default_assert_handler;
+
+  return BFD_INIT_MAGIC;
+}
 \f
 /*
 INODE
-Miscellaneous, Memory Usage, Error reporting, BFD front end
+Miscellaneous, Memory Usage, Initialization, BFD front end
 
 SECTION
        Miscellaneous
@@ -2605,34 +2639,3 @@ _bfd_get_link_info (bfd *abfd)
 
   return elf_link_info (abfd);
 }
-
-/*
-FUNCTION
-       bfd_init
-
-SYNOPSIS
-       unsigned int bfd_init (void);
-
-DESCRIPTION
-       This routine must be called before any other BFD function to
-       initialize magical internal data structures.
-       Returns a magic number, which may be used to check
-       that the bfd library is configured as expected by users.
-
-.{* Value returned by bfd_init.  *}
-.#define BFD_INIT_MAGIC (sizeof (struct bfd_section))
-.
-*/
-
-unsigned int
-bfd_init (void)
-{
-  bfd_error = bfd_error_no_error;
-  input_bfd = NULL;
-  input_error = bfd_error_no_error;
-  _bfd_error_program_name = NULL;
-  _bfd_error_internal = error_handler_fprintf;
-  _bfd_assert_handler = _bfd_default_assert_handler;
-
-  return BFD_INIT_MAGIC;
-}
index 7374e37f8cf2c721994e4ca44a19bb76b804fc1f..f348710845f557afb1759bf7f1946e545707d309 100644 (file)
@@ -198,9 +198,9 @@ IEEE-695.
 @menu
 * typedef bfd::
 * Error reporting::
+* Initialization::
 * Miscellaneous::
 * Memory Usage::
-* Initialization::
 * Sections::
 * Symbols::
 * Archives::
@@ -219,7 +219,7 @@ IEEE-695.
 @include bfdt.texi
 @include bfdio.texi
 
-@node Memory Usage, Initialization, Miscellaneous, BFD front end
+@node Memory Usage, Sections, Miscellaneous, BFD front end
 @section Memory Usage
 BFD keeps all of its internal structures in obstacks. There is one obstack
 per open BFD file, into which the current state is stored. When a BFD is
@@ -242,10 +242,7 @@ select the greediest open BFD, close it to reclaim the memory, perform
 some operation and reopen the BFD again, to get a fresh copy of the data
 structures.
 
-@node Initialization, Sections, Memory Usage, BFD front end
-@include  init.texi
-
-@node Sections, Symbols, Initialization, BFD front end
+@node Sections, Symbols, Memory Usage, BFD front end
 @include  section.texi
 
 @node Symbols, Archives, Sections, BFD front end