This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: ld/2338: objdump -d -l doesn't work correctly
> > OK. A nicer solution might be to change vmas of sections in relocatable
> > object files so that none overlap, before calling
> > _bfd_dwarf2_find_nearest_line.
That might indeed be necessary because I think HJ's patch only fixes half of
the problem in _bfd_dwarf2_find_nearest_line: bogus line numbers are indeed
not returned anymore but nothing is returned for most of the functions with
-ffunction-sections for example.
> There's a bit of nasty code to do this that I added to GDB, for
> basically the same reason. It's in symfile.c:place_section.
I presume it's the following lines:
/* For relocatable files, all loadable sections will start at zero.
The zero is meaningless, so try to pick arbitrary addresses such
that no loadable sections overlap. This algorithm is quadratic,
but the number of sections in a single object file is generally
small. */
if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
{
struct place_section_arg arg;
arg.offsets = objfile->section_offsets;
arg.lowest = 0;
bfd_map_over_sections (objfile->obfd, place_section, &arg);
}
Note that the comment seems to be overlooking -ffunction-sections.
--
Eric Botcazou