/* Main header file for the bfd library -- portable access to object files.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
Contributed by Cygnus Support.
/* The word size of the default bfd target. */
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
-#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
-#define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@
-#if @BFD_HOST_64_BIT_DEFINED@
-#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
-#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
-typedef BFD_HOST_64_BIT bfd_int64_t;
-typedef BFD_HOST_U_64_BIT bfd_uint64_t;
-#endif
-
#include <inttypes.h>
#if BFD_ARCH_SIZE >= 64
#define BFD64
#endif
-#ifndef INLINE
-#if __GNUC__ >= 2
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-#endif
-
-/* Declaring a type wide enough to hold a host long and a host pointer. */
-#define BFD_HOSTPTR_T @BFD_HOSTPTR_T@
-typedef BFD_HOSTPTR_T bfd_hostptr_t;
-
/* Forward declaration. */
typedef struct bfd bfd;
#endif
/* Silence "applying zero offset to null pointer" UBSAN warnings. */
-#define PTR_ADD(P,A) ((A) ? (P) + (A) : (P))
+#define PTR_ADD(P,A) ((A) != 0 ? (P) + (A) : (P))
/* Also prevent non-zero offsets from being applied to a null pointer. */
-#define NPTR_ADD(P,A) ((P) ? (P) + (A) : (P))
+#define NPTR_ADD(P,A) ((P) != NULL ? (P) + (A) : (P))
#ifdef BFD64
-#ifndef BFD_HOST_64_BIT
- #error No 64 bit integer type available
-#endif /* ! defined (BFD_HOST_64_BIT) */
-
-typedef BFD_HOST_U_64_BIT bfd_vma;
-typedef BFD_HOST_64_BIT bfd_signed_vma;
-typedef BFD_HOST_U_64_BIT bfd_size_type;
-typedef BFD_HOST_U_64_BIT symvalue;
-
-#if BFD_HOST_64BIT_LONG
-#define BFD_VMA_FMT "l"
-#elif defined (__MSVCRT__)
-#define BFD_VMA_FMT "I64"
-#else
-#define BFD_VMA_FMT "ll"
-#endif
-
-#ifndef fprintf_vma
-#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
-#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
-#endif
-
-#else /* not BFD64 */
-
/* Represent a target address. Also used as a generic unsigned type
which is guaranteed to be big enough to hold any arithmetic types
we need to deal with. */
-typedef unsigned long bfd_vma;
+typedef uint64_t bfd_vma;
/* A generic signed type which is guaranteed to be big enough to hold any
arithmetic types we need to deal with. Can be assumed to be compatible
with bfd_vma in the same way that signed and unsigned ints are compatible
(as parameters, in assignment, etc). */
-typedef long bfd_signed_vma;
+typedef int64_t bfd_signed_vma;
+
+typedef uint64_t bfd_size_type;
+typedef uint64_t symvalue;
-typedef unsigned long symvalue;
-typedef unsigned long bfd_size_type;
+#else /* not BFD64 */
-/* Print a bfd_vma x on stream s. */
-#define BFD_VMA_FMT "l"
-#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
-#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
+typedef uint32_t bfd_vma;
+typedef int32_t bfd_signed_vma;
+typedef uint32_t bfd_size_type;
+typedef uint32_t symvalue;
#endif /* not BFD64 */
#define HALF_BFD_SIZE_TYPE \
(((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
-#ifndef BFD_HOST_64_BIT
-/* Fall back on a 32 bit type. The idea is to make these types always
- available for function return types, but in the case that
- BFD_HOST_64_BIT is undefined such a function should abort or
- otherwise signal an error. */
-typedef bfd_signed_vma bfd_int64_t;
-typedef bfd_vma bfd_uint64_t;
-#endif
-
/* An offset into a file. BFD always uses the largest possible offset
based on the build time availability of fseek, fseeko, or fseeko64. */
typedef @bfd_file_ptr@ file_ptr;
-typedef unsigned @bfd_file_ptr@ ufile_ptr;
+typedef @bfd_ufile_ptr@ ufile_ptr;
extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
-#define printf_vma(x) fprintf_vma(stdout,x)
#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
-typedef unsigned int flagword; /* 32 bits of flags */
-typedef unsigned char bfd_byte;
+typedef uint32_t flagword; /* 32 bits of flags */
+typedef uint8_t bfd_byte;
\f
/* File formats. */
this size. */
extern unsigned long bfd_hash_set_default_size (unsigned long);
-/* Types of compressed DWARF debug sections. We currently support
- zlib. */
-enum compressed_debug_section_type
-{
- COMPRESS_DEBUG_NONE = 0,
- COMPRESS_DEBUG = 1 << 0,
- COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1,
- COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2
-};
-
/* This structure is used to keep track of stabs in sections
information while linking. */
/* Deprecated old routines. */
#if __GNUC__
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
- (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \
+ (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __func__), \
bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
- (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \
+ (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __func__), \
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
#else
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
/* Byte swapping routines. */
-bfd_uint64_t bfd_getb64 (const void *);
-bfd_uint64_t bfd_getl64 (const void *);
-bfd_int64_t bfd_getb_signed_64 (const void *);
-bfd_int64_t bfd_getl_signed_64 (const void *);
+uint64_t bfd_getb64 (const void *);
+uint64_t bfd_getl64 (const void *);
+int64_t bfd_getb_signed_64 (const void *);
+int64_t bfd_getl_signed_64 (const void *);
bfd_vma bfd_getb32 (const void *);
bfd_vma bfd_getl32 (const void *);
bfd_signed_vma bfd_getb_signed_32 (const void *);
bfd_vma bfd_getl16 (const void *);
bfd_signed_vma bfd_getb_signed_16 (const void *);
bfd_signed_vma bfd_getl_signed_16 (const void *);
-void bfd_putb64 (bfd_uint64_t, void *);
-void bfd_putl64 (bfd_uint64_t, void *);
+void bfd_putb64 (uint64_t, void *);
+void bfd_putl64 (uint64_t, void *);
void bfd_putb32 (bfd_vma, void *);
void bfd_putl32 (bfd_vma, void *);
void bfd_putb24 (bfd_vma, void *);
/* Byte swapping routines which take size and endiannes as arguments. */
-bfd_uint64_t bfd_get_bits (const void *, int, bool);
-void bfd_put_bits (bfd_uint64_t, void *, int, bool);
+uint64_t bfd_get_bits (const void *, int, bool);
+void bfd_put_bits (uint64_t, void *, int, bool);
/* mmap hacks */