When printing DEC_5 values, if the number is bigger than 99999 switch to using
authorNick Clifton <nickc@redhat.com>
Thu, 19 Jun 2003 10:23:39 +0000 (10:23 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 19 Jun 2003 10:23:39 +0000 (10:23 +0000)
hexadecimal notation.

binutils/ChangeLog
binutils/readelf.c

index 7008bf99222eec19102fe61eb6820b2b82152822..cf78bb2b0cbf0c9a934d28bb974d7e3ffca70110 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-19  Nick Clifton  <nickc@redhat.com>
+
+       * readelf.c (print_vma): When printing DEC_5 values, if the
+       number is bigger than 99999 switch to using hexadecimal
+       notation.
+
 2003-06-11  Nick Clifton  <nickc@redhat.com>
 
        * objcopy.c (gnu_debuglink_filename): New variable.
index 8e8d39e2508206cf83fa63cdbba3783c62c3fbfc..16bc44e6b91a509c67772f4fbea6597e7340cfea 100644 (file)
@@ -624,13 +624,34 @@ print_vma (vma, mode)
     {
       switch (mode)
        {
-       case FULL_HEX: printf ("0x"); /* drop through */
-       case LONG_HEX: printf ("%8.8lx", (unsigned long) vma); break;
-       case PREFIX_HEX: printf ("0x"); /* drop through */
-       case HEX: printf ("%lx", (unsigned long) vma); break;
-       case DEC: printf ("%ld", (unsigned long) vma); break;
-       case DEC_5: printf ("%5ld", (long) vma); break;
-       case UNSIGNED: printf ("%lu", (unsigned long) vma); break;
+       case FULL_HEX:
+         printf ("0x");
+         /* Drop through.  */
+       case LONG_HEX:
+         printf ("%8.8lx", (unsigned long) vma);
+         break;
+
+       case DEC_5:
+         if (vma <= 99999)
+           {
+             printf ("** %5ld", (long) vma);
+             break;
+           }
+         /* Drop through.  */
+       case PREFIX_HEX:
+         printf ("0x");
+         /* Drop through.  */
+       case HEX:
+         printf ("%lx", (unsigned long) vma);
+         break;
+
+       case DEC:
+         printf ("%ld", (unsigned long) vma);
+         break;
+
+       case UNSIGNED:
+         printf ("%lu", (unsigned long) vma);
+         break;
        }
     }
 #ifdef BFD64
@@ -640,7 +661,7 @@ print_vma (vma, mode)
        {
        case FULL_HEX:
          printf ("0x");
-         /* drop through */
+         /* Drop through.  */
 
        case LONG_HEX:
          printf_vma (vma);
@@ -648,7 +669,7 @@ print_vma (vma, mode)
 
        case PREFIX_HEX:
          printf ("0x");
-         /* drop through */
+         /* Drop through.  */
 
        case HEX:
 #if BFD_HOST_64BIT_LONG
@@ -675,13 +696,18 @@ print_vma (vma, mode)
 
        case DEC_5:
 #if BFD_HOST_64BIT_LONG
-         printf ("%5ld", vma);
+         if (vma <= 99999)
+           printf ("%5ld", vma);
+         else
+           printf ("%#lx", vma);
 #else
          if (_bfd_int64_high (vma))
            /* ugg */
            printf ("++%ld", _bfd_int64_low (vma));
-         else
+         else if (vma <= 99999)
            printf ("%5ld", _bfd_int64_low (vma));
+         else
+           printf ("%#lx", _bfd_int64_low (vma));
 #endif
          break;