summaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-01-25 16:18:41 +0000
committerNick Clifton <nickc@redhat.com>2008-01-25 16:18:41 +0000
commit8b348e93225a5d642840a3452171681de2c44fae (patch)
tree7e2345e6a0508434288e63335ea61d0c5048d0f5 /binutils/readelf.c
parent6b939cf2e87b82f29d1a673c3bddcfea4e9bb4ce (diff)
downloadbinutils-redhat-8b348e93225a5d642840a3452171681de2c44fae.tar.gz
Add mingw I64 support for printing long and long long values
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 1631a94dcc..807b0f1f26 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 <eric@andante.jic.com>
Modifications by Nick Clifton <nickc@redhat.com>
@@ -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;
}