From 7e0cfb2c2458c743e900c023b6de94c77ad12529 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 28 Jul 2008 04:07:32 +0000 Subject: bfd/ PR 6769 * bfd-in.h (BFD_VMA_FMT): Define. (printf_vma, sprintf_vma): Use the above. (_bfd_int64_low, _bfd_int64_high): Delete. * bfd-in2.h: Regenerate. binutils/ PR 6769 * readelf.c (print_dec_vma, print_hex_vma): Delete. (print_vma): Use BFD_VMA_FMT. * size.c (size_number, rprint_number): Likewise. --- bfd/ChangeLog | 8 ++++++++ bfd/bfd-in.h | 30 +++++++++++------------------- bfd/bfd-in2.h | 30 +++++++++++------------------- 3 files changed, 30 insertions(+), 38 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 643d7893e3..33b9ccca13 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2008-07-28 Alan Modra + + PR 6769 + * bfd-in.h (BFD_VMA_FMT): Define. + (printf_vma, sprintf_vma): Use the above. + (_bfd_int64_low, _bfd_int64_high): Delete. + * bfd-in2.h: Regenerate. + 2008-07-27 Alan Modra * elf.c (_bfd_elf_make_section_from_shdr): Ignore return from diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 21f4f4c788..827cc1a683 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -128,26 +128,17 @@ typedef BFD_HOST_64_BIT bfd_signed_vma; typedef BFD_HOST_U_64_BIT bfd_size_type; typedef BFD_HOST_U_64_BIT symvalue; -#ifndef fprintf_vma #if BFD_HOST_64BIT_LONG -#define sprintf_vma(s,x) sprintf (s, "%016lx", x) -#define fprintf_vma(f,x) fprintf (f, "%016lx", x) -#elif BFD_HOST_64BIT_LONG_LONG -#ifndef __MSVCRT__ -#define sprintf_vma(s,x) sprintf (s, "%016llx", x) -#define fprintf_vma(f,x) fprintf (f, "%016llx", x) -#else -#define sprintf_vma(s,x) sprintf (s, "%016I64x", x) -#define fprintf_vma(f,x) fprintf (f, "%016I64x", x) -#endif +#define BFD_VMA_FMT "l" +#elif defined (__MSVCRT__) +#define BFD_VMA_FMT "I64" #else -#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) -#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) -#define fprintf_vma(s,x) \ - fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) -#define sprintf_vma(s,x) \ - sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) +#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 */ @@ -167,8 +158,9 @@ typedef unsigned long symvalue; typedef unsigned long bfd_size_type; /* Print a bfd_vma x on stream s. */ -#define fprintf_vma(s,x) fprintf (s, "%08lx", x) -#define sprintf_vma(s,x) sprintf (s, "%08lx", x) +#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) #endif /* not BFD64 */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 087eff8903..f8e34acd9f 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -135,26 +135,17 @@ typedef BFD_HOST_64_BIT bfd_signed_vma; typedef BFD_HOST_U_64_BIT bfd_size_type; typedef BFD_HOST_U_64_BIT symvalue; -#ifndef fprintf_vma #if BFD_HOST_64BIT_LONG -#define sprintf_vma(s,x) sprintf (s, "%016lx", x) -#define fprintf_vma(f,x) fprintf (f, "%016lx", x) -#elif BFD_HOST_64BIT_LONG_LONG -#ifndef __MSVCRT__ -#define sprintf_vma(s,x) sprintf (s, "%016llx", x) -#define fprintf_vma(f,x) fprintf (f, "%016llx", x) -#else -#define sprintf_vma(s,x) sprintf (s, "%016I64x", x) -#define fprintf_vma(f,x) fprintf (f, "%016I64x", x) -#endif +#define BFD_VMA_FMT "l" +#elif defined (__MSVCRT__) +#define BFD_VMA_FMT "I64" #else -#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) -#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) -#define fprintf_vma(s,x) \ - fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) -#define sprintf_vma(s,x) \ - sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x)) +#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 */ @@ -174,8 +165,9 @@ typedef unsigned long symvalue; typedef unsigned long bfd_size_type; /* Print a bfd_vma x on stream s. */ -#define fprintf_vma(s,x) fprintf (s, "%08lx", x) -#define sprintf_vma(s,x) sprintf (s, "%08lx", x) +#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) #endif /* not BFD64 */ -- cgit v1.2.1