+ /* If there are more nonzero octets to follow, we only skip
+ zeroes in multiples of 4, to try to avoid running over
+ the start of an instruction which happens to start with
+ zero. */
+ if (z != stop_offset * opb)
+ z = addr_offset * opb + ((z - addr_offset * opb) &~ 3);
+
+ octets = z - addr_offset * opb;
+ }
+ else
+ {
+ char buf[50];
+ SFILE sfile;
+ int bpc = 0;
+ int pb = 0;
+
+ done_dot = false;
+
+ if (with_line_numbers || with_source_code)
+ show_line (aux->abfd, section, addr_offset);
+
+ if (! prefix_addresses)
+ {
+ char *s;
+
+ sprintf_vma (buf, section->vma + addr_offset);
+ for (s = buf + skip_addr_chars; *s == '0'; s++)
+ *s = ' ';
+ if (*s == '\0')
+ *--s = '0';
+ printf ("%s:\t", buf + skip_addr_chars);
+ }
+ else
+ {
+ aux->require_sec = true;
+ objdump_print_address (section->vma + addr_offset, info);
+ aux->require_sec = false;
+ putchar (' ');
+ }
+
+ if (insns)
+ {
+ sfile.size = 120;
+ sfile.buffer = xmalloc (sfile.size);
+ sfile.current = sfile.buffer;
+ info->fprintf_func = (fprintf_ftype) objdump_sprintf;
+ info->stream = (FILE *) &sfile;
+ info->bytes_per_line = 0;
+ info->bytes_per_chunk = 0;
+
+#ifdef DISASSEMBLER_NEEDS_RELOCS
+ /* FIXME: This is wrong. It tests the number of octets
+ in the last instruction, not the current one. */
+ if (*relppp < relppend
+ && (**relppp)->address >= addr_offset
+ && (**relppp)->address <= addr_offset + octets / opb)
+ info->flags = INSN_HAS_RELOC;
+ else
+#endif
+ info->flags = 0;
+
+ octets = (*disassemble_fn) (section->vma + addr_offset, info);
+ info->fprintf_func = (fprintf_ftype) fprintf;
+ info->stream = stdout;
+ if (info->bytes_per_line != 0)
+ octets_per_line = info->bytes_per_line;
+ if (octets < 0)
+ {
+ if (sfile.current != sfile.buffer)
+ printf ("%s\n", sfile.buffer);
+ free (sfile.buffer);
+ break;
+ }
+ }
+ else
+ {
+ bfd_vma j;
+
+ octets = octets_per_line;
+ if (addr_offset + octets / opb > stop_offset)
+ octets = (stop_offset - addr_offset) * opb;
+
+ for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j)
+ {
+ if (isprint (data[j]))
+ buf[j - addr_offset * opb] = data[j];
+ else
+ buf[j - addr_offset * opb] = '.';
+ }
+ buf[j - addr_offset * opb] = '\0';
+ }
+
+ if (prefix_addresses
+ ? show_raw_insn > 0
+ : show_raw_insn >= 0)
+ {
+ bfd_vma j;
+
+ /* If ! prefix_addresses and ! wide_output, we print
+ octets_per_line octets per line. */
+ pb = octets;
+ if (pb > octets_per_line && ! prefix_addresses && ! wide_output)
+ pb = octets_per_line;
+
+ if (info->bytes_per_chunk)
+ bpc = info->bytes_per_chunk;
+ else
+ bpc = 1;
+
+ for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
+ {
+ int k;
+ if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
+ {
+ for (k = bpc - 1; k >= 0; k--)
+ printf ("%02x", (unsigned) data[j + k]);
+ putchar (' ');
+ }
+ else
+ {
+ for (k = 0; k < bpc; k++)
+ printf ("%02x", (unsigned) data[j + k]);
+ putchar (' ');
+ }
+ }
+
+ for (; pb < octets_per_line; pb += bpc)
+ {
+ int k;
+
+ for (k = 0; k < bpc; k++)
+ printf (" ");
+ putchar (' ');
+ }
+
+ /* Separate raw data from instruction by extra space. */
+ if (insns)
+ putchar ('\t');
+ else
+ printf (" ");
+ }
+
+ if (! insns)
+ printf ("%s", buf);
+ else
+ {
+ printf ("%s", sfile.buffer);
+ free (sfile.buffer);
+ }
+
+ if (prefix_addresses
+ ? show_raw_insn > 0
+ : show_raw_insn >= 0)
+ {
+ while (pb < octets)
+ {
+ bfd_vma j;
+ char *s;
+
+ putchar ('\n');
+ j = addr_offset * opb + pb;
+
+ sprintf_vma (buf, section->vma + j / opb);
+ for (s = buf + skip_addr_chars; *s == '0'; s++)
+ *s = ' ';
+ if (*s == '\0')
+ *--s = '0';
+ printf ("%s:\t", buf + skip_addr_chars);
+
+ pb += octets_per_line;
+ if (pb > octets)
+ pb = octets;
+ for (; j < addr_offset * opb + pb; j += bpc)
+ {
+ int k;
+
+ if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
+ {
+ for (k = bpc - 1; k >= 0; k--)
+ printf ("%02x", (unsigned) data[j + k]);
+ putchar (' ');
+ }
+ else
+ {
+ for (k = 0; k < bpc; k++)
+ printf ("%02x", (unsigned) data[j + k]);
+ putchar (' ');
+ }
+ }
+ }
+ }
+
+ if (!wide_output)
+ putchar ('\n');
+ else
+ need_nl = true;
+ }
+
+ if ((section->flags & SEC_RELOC) != 0
+#ifndef DISASSEMBLER_NEEDS_RELOCS
+ && dump_reloc_info
+#endif
+ )
+ {
+ while ((*relppp) < relppend
+ && ((**relppp)->address >= (bfd_vma) addr_offset
+ && (**relppp)->address < (bfd_vma) addr_offset + octets / opb))
+#ifdef DISASSEMBLER_NEEDS_RELOCS
+ if (! dump_reloc_info)
+ ++(*relppp);
+ else
+#endif
+ {
+ arelent *q;
+
+ q = **relppp;
+
+ if (wide_output)
+ putchar ('\t');
+ else
+ printf ("\t\t\t");
+
+ objdump_print_value (section->vma + q->address, info, true);
+
+ printf (": %s\t", q->howto->name);
+
+ if (q->sym_ptr_ptr == NULL || *q->sym_ptr_ptr == NULL)
+ printf ("*unknown*");
+ else
+ {
+ const char *sym_name;
+
+ sym_name = bfd_asymbol_name (*q->sym_ptr_ptr);
+ if (sym_name != NULL && *sym_name != '\0')
+ objdump_print_symname (aux->abfd, info, *q->sym_ptr_ptr);
+ else
+ {
+ asection *sym_sec;
+
+ sym_sec = bfd_get_section (*q->sym_ptr_ptr);
+ sym_name = bfd_get_section_name (aux->abfd, sym_sec);
+ if (sym_name == NULL || *sym_name == '\0')
+ sym_name = "*unknown*";
+ printf ("%s", sym_name);
+ }
+ }