objdump very long run time when using -D -z flags
Fangrui Song
i@maskray.me
Fri May 1 01:22:11 GMT 2020
More information about the Binutils mailing list
Fri May 1 01:22:11 GMT 2020
- Previous message (by thread): ld: SHF_MERGE sections on both sides of a symbol assignment
- Next message (by thread): objdump very long run time when using -D -z flags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Apr 30, 2020 at 7:26 AM Haim Shimonovich via Binutils <binutils@sourceware.org> wrote: > > 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 > This just hides the problem. -z is still going to be slow. To avoid the quadratic behavior, we should increase the address by at least `z` if we have scanned `z` zeros.
- Previous message (by thread): ld: SHF_MERGE sections on both sides of a symbol assignment
- Next message (by thread): objdump very long run time when using -D -z flags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list