Include bfd_stdint.h in bfd.h
authorAlan Modra <amodra@gmail.com>
Tue, 18 Dec 2018 08:33:51 +0000 (19:03 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 18 Dec 2018 13:19:48 +0000 (23:49 +1030)
This patch adds bfd_stdint.h to bfd.h, so that BFD can use size_t
where appropriate in function parameters and return values.  I also
tidy a few other cases where headers are included twice.

bfd/
* Makefile.am (bfdinclude_HEADERS): Add bfd_stdint.h.
(BFD_H_DEPS): Add include/diagnostics.h.
(LOCAL_H_DEPS): Add bfd_stdint.h.
* bfd-in.h: Include bfd_stdint.h.
* arc-plt.h: Don't include stdint.h.
* coff-rs6000.c: Likewise.
* coff64-rs6000.c: Likewise.
* elfxx-riscv.c: Likewise.
* cache.c: Don't include bfd_stdint.h.
* elf32-arm.c: Likewise.
* elf32-avr.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-rl78.c: Likewise.
* elf32-rx.c: Likewise.
* elf32-wasm32.c: Likewise.
* elf64-nfp.c: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-x86.h: Likewise.
* wasm-module.c: Likewise, and don't include sysdep.h twice.
* elf-nacl.h: Don't include bfd.h.
* mach-o.h: Likewise.
* elfxx-aarch64.c: Include bfd.h and elf-bfd.h.
* elfxx-aarch64.h: Don't include bfd.h, elf-bfd.h or stdint.h.
* mach-o-aarch64.c: Include mach-o.h later.
* mach-o-arm.c: Likewise.
* mach-o-i386.c: Likewise.
* mach-o-x86-64.c: Likewise.
* mach-o.c: Likewise.
* sysdep.h: Don't include ansidecl.h or sys/stat.h.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
opcodes/
* arm-dis.c: Include bfd.h.
* aarch64-opc.c: Include bfd_stdint.h rather than stdint.h.
* csky-dis.c: Likewise.
* nds32-asm.c: Likewise.
* riscv-dis.c: Likewise.
* s12z-dis.c: Likewise.
* wasm32-dis.c: Likewise.

41 files changed:
bfd/ChangeLog
bfd/Makefile.am
bfd/Makefile.in
bfd/arc-plt.h
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/cache.c
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/elf-nacl.h
bfd/elf32-arm.c
bfd/elf32-avr.c
bfd/elf32-nds32.c
bfd/elf32-rl78.c
bfd/elf32-rx.c
bfd/elf32-wasm32.c
bfd/elf64-nfp.c
bfd/elflink.c
bfd/elfnn-aarch64.c
bfd/elfnn-ia64.c
bfd/elfxx-aarch64.c
bfd/elfxx-aarch64.h
bfd/elfxx-ia64.c
bfd/elfxx-riscv.c
bfd/elfxx-x86.h
bfd/mach-o-aarch64.c
bfd/mach-o-arm.c
bfd/mach-o-i386.c
bfd/mach-o-x86-64.c
bfd/mach-o.c
bfd/mach-o.h
bfd/sysdep.h
bfd/wasm-module.c
opcodes/ChangeLog
opcodes/aarch64-opc.c
opcodes/arm-dis.c
opcodes/csky-dis.c
opcodes/nds32-asm.c
opcodes/riscv-dis.c
opcodes/s12z-dis.c
opcodes/wasm32-dis.c

index 8fcdb59..3485593 100644 (file)
@@ -1,5 +1,42 @@
 2018-12-18  Alan Modra  <amodra@gmail.com>
 
+       * Makefile.am (bfdinclude_HEADERS): Add bfd_stdint.h.
+       (BFD_H_DEPS): Add include/diagnostics.h.
+       (LOCAL_H_DEPS): Add bfd_stdint.h.
+       * bfd-in.h: Include bfd_stdint.h.
+       * arc-plt.h: Don't include stdint.h.
+       * coff-rs6000.c: Likewise.
+       * coff64-rs6000.c: Likewise.
+       * elfxx-riscv.c: Likewise.
+       * cache.c: Don't include bfd_stdint.h.
+       * elf32-arm.c: Likewise.
+       * elf32-avr.c: Likewise.
+       * elf32-nds32.c: Likewise.
+       * elf32-rl78.c: Likewise.
+       * elf32-rx.c: Likewise.
+       * elf32-wasm32.c: Likewise.
+       * elf64-nfp.c: Likewise.
+       * elflink.c: Likewise.
+       * elfnn-aarch64.c: Likewise.
+       * elfnn-ia64.c: Likewise.
+       * elfxx-ia64.c: Likewise.
+       * elfxx-x86.h: Likewise.
+       * wasm-module.c: Likewise, and don't include sysdep.h twice.
+       * elf-nacl.h: Don't include bfd.h.
+       * mach-o.h: Likewise.
+       * elfxx-aarch64.c: Include bfd.h and elf-bfd.h.
+       * elfxx-aarch64.h: Don't include bfd.h, elf-bfd.h or stdint.h.
+       * mach-o-aarch64.c: Include mach-o.h later.
+       * mach-o-arm.c: Likewise.
+       * mach-o-i386.c: Likewise.
+       * mach-o-x86-64.c: Likewise.
+       * mach-o.c: Likewise.
+       * sysdep.h: Don't include ansidecl.h or sys/stat.h.
+       * Makefile.in: Regenerate.
+       * bfd-in2.h: Regenerate.
+
+2018-12-18  Alan Modra  <amodra@gmail.com>
+
        PR 23980
        * elf32-i386.c (elf_i386_relocate_section): Exit with wrong format
        error rather than asserting input file is as expected.
index 2626ceb..3d60628 100644 (file)
@@ -33,7 +33,7 @@ bfdlibdir = @bfdlibdir@
 bfdincludedir = @bfdincludedir@
 bfdlib_LTLIBRARIES = libbfd.la
 bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
-                    $(INCDIR)/bfdlink.h $(INCDIR)/diagnostics.h
+                    bfd_stdint.h $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
 else !INSTALL_LIBBFD
 # Empty these so that the respective installation directories will not be created.
 bfdlibdir =
@@ -873,8 +873,8 @@ pex64igen.c: peXXigen.c
        $(SED) -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
        mv -f pex64igen.new pex64igen.c
 
-BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
-LOCAL_H_DEPS= libbfd.h sysdep.h config.h
+BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
+LOCAL_H_DEPS= libbfd.h sysdep.h config.h bfd_stdint.h
 $(BFD32_LIBS) \
  $(BFD64_LIBS) \
  $(ALL_MACHINES) \
index e63d63a..4034244 100644 (file)
@@ -248,8 +248,8 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 am__bfdinclude_HEADERS_DIST = $(INCDIR)/plugin-api.h bfd.h \
-       $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h \
-       $(INCDIR)/diagnostics.h
+       $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bfd_stdint.h \
+       $(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
 HEADERS = $(bfdinclude_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
   distclean-recursive maintainer-clean-recursive
@@ -468,8 +468,8 @@ libbfd_la_LDFLAGS = $(am__append_1) -release `cat libtool-soversion` \
 @INSTALL_LIBBFD_FALSE@bfdinclude_HEADERS = $(am__append_2)
 @INSTALL_LIBBFD_TRUE@bfdinclude_HEADERS = $(BFD_H) \
 @INSTALL_LIBBFD_TRUE@  $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
-@INSTALL_LIBBFD_TRUE@  $(INCDIR)/bfdlink.h \
-@INSTALL_LIBBFD_TRUE@  $(INCDIR)/diagnostics.h $(am__append_2)
+@INSTALL_LIBBFD_TRUE@  bfd_stdint.h $(INCDIR)/diagnostics.h \
+@INSTALL_LIBBFD_TRUE@  $(INCDIR)/bfdlink.h $(am__append_2)
 @INSTALL_LIBBFD_FALSE@rpath_bfdlibdir = @bfdlibdir@
 @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libbfd.la
 
@@ -1146,8 +1146,8 @@ libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB)
 # everything else starts using libtool.  FIXME.
 noinst_LIBRARIES = libbfd.a
 libbfd_a_SOURCES = 
-BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
-LOCAL_H_DEPS = libbfd.h sysdep.h config.h
+BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
+LOCAL_H_DEPS = libbfd.h sysdep.h config.h bfd_stdint.h
 BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c \
        bfdio.c bfdwin.c section.c archures.c reloc.c \
        syms.c bfd.c archive.c corefile.c targets.c format.c \
index 2f4ba86..994b488 100644 (file)
@@ -22,8 +22,6 @@
 #ifndef ARC_PLT_H
 #define ARC_PLT_H
 
-#include <stdint.h>
-
 /* Instructions appear in memory as a sequence of half-words (16 bit);
    individual half-words are represented on the target in target byte order.
    We use 'unsigned short' on the host to represent the PLT templates,
index 47b60bc..5657d93 100644 (file)
@@ -34,6 +34,7 @@ extern "C" {
 
 #include "ansidecl.h"
 #include "symcat.h"
+#include "bfd_stdint.h"
 #include "diagnostics.h"
 #include <stdarg.h>
 #include <sys/stat.h>
index 6d92c51..ab71c35 100644 (file)
@@ -41,6 +41,7 @@ extern "C" {
 
 #include "ansidecl.h"
 #include "symcat.h"
+#include "bfd_stdint.h"
 #include "diagnostics.h"
 #include <stdarg.h>
 #include <sys/stat.h>
index faee677..17c84cc 100644 (file)
@@ -44,7 +44,6 @@ SUBSECTION
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
-#include "bfd_stdint.h"
 
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
index edff50d..65ae05c 100644 (file)
@@ -114,7 +114,6 @@ extern int rs6000coff_core_file_failing_signal (bfd *abfd);
 #define bfd_pe_print_pdata     NULL
 #endif
 
-#include <stdint.h>
 #include "coffcode.h"
 
 /* The main body of code is in coffcode.h.  */
index 928a23d..6e52347 100644 (file)
@@ -278,7 +278,6 @@ extern int rs6000coff_core_file_failing_signal
 #define bfd_pe_print_pdata     NULL
 #endif
 
-#include <stdint.h>
 #include "coffcode.h"
 
 /* For XCOFF64, the effective width of symndx changes depending on
index 8ca0618..1b691a3 100644 (file)
@@ -16,8 +16,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "bfd.h"
-
 bfd_boolean nacl_modify_segment_map (bfd *, struct bfd_link_info *);
 bfd_boolean nacl_modify_program_headers (bfd *, struct bfd_link_info *);
 void nacl_final_write_processing (bfd *, bfd_boolean linker);
index 5adec5e..9fda98e 100644 (file)
@@ -22,7 +22,6 @@
 #include <limits.h>
 
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "libiberty.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
index 13e28d8..527149c 100644 (file)
@@ -25,7 +25,6 @@
 #include "elf-bfd.h"
 #include "elf/avr.h"
 #include "elf32-avr.h"
-#include "bfd_stdint.h"
 
 /* Enable debugging printout at stdout with this variable.  */
 static bfd_boolean debug_relax = FALSE;
index 184cf32..c7e1519 100644 (file)
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "bfdlink.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "libiberty.h"
-#include "bfd_stdint.h"
 #include "elf/nds32.h"
 #include "opcode/nds32.h"
 #include "elf32-nds32.h"
index e072b1a..3a96f41 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/rl78.h"
index ddcf5e9..68fac29 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/rx.h"
index 9fc48de..d4e54ca 100644 (file)
@@ -22,7 +22,6 @@
 #include "bfd.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
-#include "bfd_stdint.h"
 #include "libiberty.h"
 #include "elf/wasm32.h"
 
index 3cdda3d..e043535 100755 (executable)
@@ -24,7 +24,6 @@
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/nfp.h"
-#include "bfd_stdint.h"
 
 
 static bfd_reloc_status_type
index 8992a50..f5b411b 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "sysdep.h"
 #include "bfd.h"
-#include "bfd_stdint.h"
 #include "bfdlink.h"
 #include "libbfd.h"
 #define ARCH_SIZE 0
index 083f90b..8b5124b 100644 (file)
 #include "bfd.h"
 #include "libiberty.h"
 #include "libbfd.h"
-#include "bfd_stdint.h"
 #include "elf-bfd.h"
 #include "bfdlink.h"
 #include "objalloc.h"
index e6551df..56572d3 100644 (file)
@@ -27,7 +27,6 @@
 #include "elf/ia64.h"
 #include "objalloc.h"
 #include "hashtab.h"
-#include "bfd_stdint.h"
 #include "elfxx-ia64.h"
 
 #define ARCH_SIZE      NN
index b8a541a..e3b6ef6 100644 (file)
@@ -19,6 +19,8 @@
    see <http://www.gnu.org/licenses/>.  */
 
 #include "sysdep.h"
+#include "bfd.h"
+#include "elf-bfd.h"
 #include "elfxx-aarch64.h"
 #include <stdarg.h>
 #include <string.h>
index 301af73..0aa536a 100644 (file)
    along with this program; see the file COPYING3. If not,
    see <http://www.gnu.org/licenses/>.  */
 
-#include "bfd.h"
-#include "elf-bfd.h"
-#include "stdint.h"
-
 /* Take the PAGE component of an address or offset.  */
 #define PG(x)       ((x) & ~ (bfd_vma) 0xfff)
 #define PG_OFFSET(x) ((x) &   (bfd_vma) 0xfff)
index 290dcd8..2c96f05 100644 (file)
@@ -27,7 +27,6 @@
 #include "elf/ia64.h"
 #include "objalloc.h"
 #include "hashtab.h"
-#include "bfd_stdint.h"
 #include "elfxx-ia64.h"
 
 /* THE RULES for all the stuff the linker creates --
index a88c7fa..d92b273 100644 (file)
@@ -29,7 +29,6 @@
 #include "libiberty.h"
 #include "elfxx-riscv.h"
 #include "safe-ctype.h"
-#include <stdint.h>
 
 #define MINUS_ONE ((bfd_vma)0 - 1)
 
index d153623..2415987 100644 (file)
@@ -23,7 +23,6 @@
 #include "bfdlink.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
-#include "bfd_stdint.h"
 #include "hashtab.h"
 
 #define PLT_CIE_LENGTH         20
index 7013d26..018ac2e 100644 (file)
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/arm64.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_arm64_object_p
index 738b2f1..5182c97 100644 (file)
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/arm.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_arm_object_p
index 4918e5e..db92e5d 100644 (file)
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/reloc.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_i386_object_p
index 9ee93a4..153a85c 100644 (file)
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "mach-o/x86-64.h"
 
 #define bfd_mach_o_object_p bfd_mach_o_x86_64_object_p
index 5121715..11e946c 100644 (file)
    MA 02110-1301, USA.  */
 
 #include "sysdep.h"
-#include "mach-o.h"
 #include "bfd.h"
 #include "libbfd.h"
 #include "libiberty.h"
+#include "mach-o.h"
 #include "aout/stab_gnu.h"
 #include "mach-o/reloc.h"
 #include "mach-o/external.h"
index 61428d6..97547a5 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef _BFD_MACH_O_H_
 #define _BFD_MACH_O_H_
 
-#include "bfd.h"
 #include "mach-o/loader.h"
 #include "mach-o/external.h"
 
index bc7dbcf..7152d77 100644 (file)
 
 #include "config.h"
 
-#include "ansidecl.h"
-
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
 #endif
 
 #include <stdio.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 
 #include <errno.h>
 #if !(defined(errno) || defined(_MSC_VER) && defined(_INC_ERRNO))
index 6806e0f..3deaf42 100644 (file)
@@ -28,9 +28,7 @@
 #include "sysdep.h"
 #include "alloca-conf.h"
 #include "bfd.h"
-#include "sysdep.h"
 #include <limits.h>
-#include "bfd_stdint.h"
 #include "libiberty.h"
 #include "libbfd.h"
 #include "wasm-module.h"
index 880f863..8676f5f 100644 (file)
@@ -1,3 +1,13 @@
+2018-12-18  Alan Modra  <amodra@gmail.com>
+
+       * arm-dis.c: Include bfd.h.
+       * aarch64-opc.c: Include bfd_stdint.h rather than stdint.h.
+       * csky-dis.c: Likewise.
+       * nds32-asm.c: Likewise.
+       * riscv-dis.c: Likewise.
+       * s12z-dis.c: Likewise.
+       * wasm32-dis.c: Likewise.
+
 2018-12-07  Jim Wilson  <jimw@sifive.com>
 
        PR gas/23956
index b047d2f..72ff4d5 100644 (file)
@@ -22,7 +22,7 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <stdarg.h>
 #include <inttypes.h>
 
index 8e6a37b..0061970 100644 (file)
@@ -32,6 +32,7 @@
 /* FIXME: This shouldn't be done here.  */
 #include "coff/internal.h"
 #include "libcoff.h"
+#include "bfd.h"
 #include "elf-bfd.h"
 #include "elf/internal.h"
 #include "elf/arm.h"
index 9c3495f..f57b9da 100644 (file)
@@ -22,7 +22,7 @@
 #include "sysdep.h"
 #include "config.h"
 #include <stdio.h>
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include "disassemble.h"
 #include "elf-bfd.h"
 #include "opcode/csky.h"
index f0dd326..94f0af2 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "sysdep.h"
 
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <assert.h>
 
 #include "safe-ctype.h"
index f1bbfdb..ab7575a 100644 (file)
@@ -28,7 +28,7 @@
 #include "elf-bfd.h"
 #include "elf/riscv.h"
 
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <ctype.h>
 
 struct riscv_private_data
index 719f172..5d9307b 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "sysdep.h"
 #include <stdio.h>
-#include <stdint.h>
+#include "bfd_stdint.h"
 #include <stdbool.h>
 #include <assert.h>
 
index d6f1697..9b5dea4 100644 (file)
@@ -27,7 +27,7 @@
 #include "elf-bfd.h"
 #include "elf/internal.h"
 #include "elf/wasm32.h"
-#include <stdint.h>
+#include "bfd_stdint.h"
 
 /* Type names for blocks and signatures.  */
 #define BLOCK_TYPE_NONE              0x40