[PATCH 3/3] bfd: Improve lookup of file / line information for errors
Nick Clifton
nickc@redhat.com
Tue Feb 14 09:10:00 GMT 2017
Hi Andrew,
> @@ -4155,6 +4155,38 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
The find_nearest_line functions are used not only when emitting error/warning
messages, but also when displaying disassembly mixed with source code. Hence
it is helpful if these functions can be relatively efficient. (I have fixed
several PRs over the last year about "objdump -dS" being very slow...) With
that in mind then:
> + for (tmp = symbols; (*tmp) != NULL; ++tmp)
> + if ((*tmp)->the_bfd == abfd
> + && (*tmp)->section == section
> + && (*tmp)->value == offset
> + && ((*tmp)->flags & BSF_SECTION_SYM) == 0)
Wouldn't a binary search be more efficient here ? Also it might be worthwhile
caching the result in case the next call is for the same offset, or a very similar
one.
Cheers
Nick
More information about the Binutils
mailing list