* objdump.c (disassemble_bytes): Don't skip leading zeros when
authorAlan Modra <amodra@gmail.com>
Mon, 10 Nov 2008 08:45:13 +0000 (08:45 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 10 Nov 2008 08:45:13 +0000 (08:45 +0000)
end of section calculation overflows.

binutils/ChangeLog
binutils/objdump.c

index cb506bfbe50b575ba2ec0f9ba5ecd7f3499a6ec5..587a60df5074e3e9e7f5924c89c10bc3593f4862 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-10  Tristan Gingold  <gingold@adacore.com>
+           Alan Modra  <amodra@bigpond.net.au>
+
+       * objdump.c (disassemble_bytes): Don't skip leading zeros when
+       end of section calculation overflows.
+
 2008-11-07  Prafulla Thakare  <prafulla.thakare@kpitcummins.com>
 
        * MAINTAINERS: Take over from Anil Paranjpe as H8300 maintainer.
index 5fad8ddcce99b7b75dfcbcd05cbe2f0459b67840..76f595b487156d1313f8bcae627111b26669adb3 100644 (file)
@@ -1372,19 +1372,18 @@ disassemble_bytes (struct disassemble_info * info,
   if (! prefix_addresses)
     {
       char buf[30];
-      char *s;
-
-      bfd_sprintf_vma
-       (aux->abfd, buf,
-        (section->vma
-         + bfd_section_size (section->owner, section) / opb));
-      s = buf;
-      while (s[0] == '0' && s[1] == '0' && s[2] == '0' && s[3] == '0'
-            && s[4] == '0')
-       {
-         skip_addr_chars += 4;
-         s += 4;
-       }
+
+      bfd_sprintf_vma (aux->abfd, buf, section->vma + section->size / opb);
+
+      while (buf[skip_addr_chars] == '0')
+       ++skip_addr_chars;
+
+      /* Don't discard zeros on overflow.  */
+      if (buf[skip_addr_chars] == '\0' && section->vma != 0)
+       skip_addr_chars = 0;
+
+      if (skip_addr_chars != 0)
+       skip_addr_chars = (skip_addr_chars - 1) & -4;
     }
 
   info->insn_info_valid = 0;