objdump very long run time when using -D -z flags
Haim Shimonovich
Haim.Shimonovich@ceva-dsp.com
Thu Apr 30 14:26:36 GMT 2020
Hi,
This problem occurs when defining a large uninitialized array or section.
A simple example can recreate this bug:
#include "stdio.h"
int arr[1000000];
int main(){
printf("hello world\n");
return 0;
}
I traced the problem to the following highlighted code (objdump.c):
addr_offset = start_offset;
while (addr_offset < stop_offset)
{
bfd_vma z;
bfd_boolean need_nl = FALSE;
int previous_octets;
/* Remember the length of the previous instruction. */
previous_octets = octets;
octets = 0;
/* Make sure we don't use relocs from previous instructions. */
aux->reloc = NULL;
/* If we see more than SKIP_ZEROES octets of zeroes, we just
print `...'. */
for (z = addr_offset * opb; z < stop_offset * opb; z++)
if (data[z] != 0)
break;
I suggest the following fix (performing the loop only when -z is not used):
addr_offset = start_offset;
while (addr_offset < stop_offset)
{
bfd_vma z;
bfd_boolean need_nl = FALSE;
int previous_octets;
/* Remember the length of the previous instruction. */
previous_octets = octets;
octets = 0;
/* Make sure we don't use relocs from previous instructions. */
aux->reloc = NULL;
/* If we see more than SKIP_ZEROES octets of zeroes, we just
print `...'. */
if (! disassemble_zeroes){
for (z = addr_offset * opb; z < stop_offset * opb; z++)
if (data[z] != 0)
break;
}
I would like to hear any comments regarding my suggestion.
Thanks,
Haim Shimonovich
More information about the Binutils
mailing list