summaryrefslogtreecommitdiff
path: root/bfd/bfd-in.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-07-31 19:25:32 +0930
committerAlan Modra <amodra@gmail.com>2022-08-01 09:33:24 +0930
commitb336123a087f9a85e7b24d7e420bd44b9c9d3552 (patch)
treefaaf20ca195e77ead3fb51acd168d9e0d101cab0 /bfd/bfd-in.h
parent3940a46487037b51d4100004d317e3b6f0abd3ad (diff)
PR29348, BFD_VMA_FMT wrong
There is a problem with my commit 0e3c1eebb2, which replaced bfd_uint64_t with uint64_t: Some hosts typedef int64_t to long long even when long is the same size as long long. That confuses the code choosing one of "l", "ll", or "I64" for BFD_VMA_FMT, and results in warnings. Write a direct configure test for the printf int64_t style instead. This removes the last use of BFD_HOST_64BIT_LONG, so delete that. Note that the changes to configure.com are pure guesswork. PR 29348 * bfd-in.h (BFD_HOST_64BIT_LONG): Don't define. (BFD_VMA_FMT): Define using BFD_INT64_FMT when 64-bit. (bfd_vma, bfd_signed_vma): Move comments to 64-bit typedefs. * configure.ac (BFD_HOST_64BIT_LONG): Delete. (BFD_INT64_FMT): New config test. * configure.com: Update similarly. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * configure: Regenerate. (cherry picked from commit 1a5178fe284547ef2abd8ae66588c9999d61c524)
Diffstat (limited to 'bfd/bfd-in.h')
-rw-r--r--bfd/bfd-in.h34
1 files changed, 12 insertions, 22 deletions
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index dce682af99..9d0738a232 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -69,8 +69,6 @@ extern "C" {
/* 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@
-
#include <inttypes.h>
#if BFD_ARCH_SIZE >= 64
@@ -101,42 +99,34 @@ typedef struct bfd bfd;
#ifdef 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 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 int64_t bfd_signed_vma;
+
typedef uint64_t bfd_size_type;
typedef uint64_t 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
+#define BFD_VMA_FMT @BFD_INT64_FMT@
-#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
+#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
#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;
-
-/* 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 unsigned long symvalue;
typedef unsigned long bfd_size_type;
-/* 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)