From 6e3d6dc1ed34b1a58ed922ce31a5cf63502f4bce Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 25 Jan 2008 16:18:41 +0000 Subject: Add mingw I64 support for printing long and long long values --- binutils/readelf.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'binutils/readelf.c') diff --git a/binutils/readelf.c b/binutils/readelf.c index 1631a94..807b0f1 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -1,6 +1,6 @@ /* readelf.c -- display contents of an ELF format file - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 - Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008 Free Software Foundation, Inc. Originally developed by Eric Youngdale Modifications by Nick Clifton @@ -493,8 +493,12 @@ print_vma (bfd_vma vma, print_mode mode) #if BFD_HOST_64BIT_LONG return nc + printf ("%lx", vma); #elif BFD_HOST_64BIT_LONG_LONG +#ifndef __MSVCRT__ return nc + printf ("%llx", vma); #else + return nc + printf ("%I64x", vma); +#endif +#else return nc + print_hex_vma (vma); #endif @@ -502,8 +506,12 @@ print_vma (bfd_vma vma, print_mode mode) #if BFD_HOST_64BIT_LONG return printf ("%ld", vma); #elif BFD_HOST_64BIT_LONG_LONG +#ifndef __MSVCRT__ return printf ("%lld", vma); #else + return printf ("%I64d", vma); +#endif +#else return print_dec_vma (vma, 1); #endif @@ -514,12 +522,19 @@ print_vma (bfd_vma vma, print_mode mode) else return printf ("%#lx", vma); #elif BFD_HOST_64BIT_LONG_LONG +#ifndef __MSVCRT__ if (vma <= 99999) return printf ("%5lld", vma); else return printf ("%#llx", vma); #else if (vma <= 99999) + return printf ("%5I64d", vma); + else + return printf ("%#I64x", vma); +#endif +#else + if (vma <= 99999) return printf ("%5ld", _bfd_int64_low (vma)); else return print_hex_vma (vma); @@ -529,8 +544,12 @@ print_vma (bfd_vma vma, print_mode mode) #if BFD_HOST_64BIT_LONG return printf ("%lu", vma); #elif BFD_HOST_64BIT_LONG_LONG +#ifndef __MSVCRT__ return printf ("%llu", vma); #else + return printf ("%I64u", vma); +#endif +#else return print_dec_vma (vma, 0); #endif } @@ -990,12 +1009,19 @@ dump_relocations (FILE *file, : "%12.12lx %12.12lx ", offset, info); #elif BFD_HOST_64BIT_LONG_LONG +#ifndef __MSVCRT__ printf (do_wide ? "%16.16llx %16.16llx " : "%12.12llx %12.12llx ", offset, info); #else printf (do_wide + ? "%16.16I64x %16.16I64x " + : "%12.12I64x %12.12I64x ", + offset, info); +#endif +#else + printf (do_wide ? "%8.8lx%8.8lx %8.8lx%8.8lx " : "%4.4lx%8.8lx %4.4lx%8.8lx ", _bfd_int64_high (offset), @@ -7820,7 +7846,11 @@ dump_section_as_strings (Elf_Internal_Shdr *section, FILE *file) if (data < end) { +#ifndef __MSVCRT__ printf (" [%6tx] %s\n", data - start, data); +#else + printf (" [%6Ix] %s\n", (size_t) (data - start), data); +#endif data += strlen (data); some_strings_shown = TRUE; } -- cgit v1.1