Include bfd_stdint.h in bfd.h

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.
This commit is contained in:
Alan Modra 2018-12-18 19:03:51 +10:30
parent a529dcc854
commit 2d5d5a8f0a
41 changed files with 72 additions and 51 deletions

View File

@ -1,3 +1,40 @@
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

View 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) \

View 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 \

View 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,

View 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>

View 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>

View 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>

View 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. */

View 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

View 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);

View 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"

View 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;

View File

@ -22,12 +22,10 @@
#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"

View 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"

View 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"

View 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"

View File

@ -24,7 +24,6 @@
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/nfp.h"
#include "bfd_stdint.h"
static bfd_reloc_status_type

View 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

View File

@ -139,7 +139,6 @@
#include "bfd.h"
#include "libiberty.h"
#include "libbfd.h"
#include "bfd_stdint.h"
#include "elf-bfd.h"
#include "bfdlink.h"
#include "objalloc.h"

View 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

View 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>

View File

@ -18,10 +18,6 @@
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)

View 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 --

View 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)

View 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

View File

@ -19,10 +19,10 @@
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

View File

@ -19,10 +19,10 @@
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

View File

@ -19,10 +19,10 @@
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

View File

@ -19,10 +19,10 @@
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

View File

@ -19,10 +19,10 @@
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"

View 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"

View File

@ -28,15 +28,12 @@
#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))

View 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"

View 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

View 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>

View 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"

View 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"

View File

@ -22,7 +22,7 @@
#include "sysdep.h"
#include <stdint.h>
#include "bfd_stdint.h"
#include <assert.h>
#include "safe-ctype.h"

View 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

View File

@ -20,7 +20,7 @@
#include "sysdep.h"
#include <stdio.h>
#include <stdint.h>
#include "bfd_stdint.h"
#include <stdbool.h>
#include <assert.h>

View 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