_bfd_dwarf2_find_nearest_line returns wrong filename
Daniel Jacobowitz
drow@false.org
Mon Dec 30 17:19:00 GMT 2002
[Sorry for the extra copy, Andreas. Meant to send this to the list.]
On Tue, Dec 31, 2002 at 12:03:35AM +0100, Andreas Schwab wrote:
> Nick Clifton <nickc@redhat.com> writes:
>
> > > 2002-12-23 Andreas Schwab <schwab@suse.de>
> > >
> > > * dwarf2.c (struct dwarf2_debug): Add relocs and reloc_count.
> > > (find_rela_addend): Take pointer to struct dwarf2_debug instead of
> > > section and symbols. Cache reloc section there. Don't check
> > > section in reloc, just compare offset.
> > > (read_indirect_string): Use find_rela_addend to relocate string
> > > offset.
> > > (parse_comp_unit): Adjust call to find_rela_addend. Don't
> > > advance to next debug section until after
> > > comp_unit_find_nearest_line has been called.
> >
> > Approved - please apply.
>
> Unfortunately this has a two problems. First, on ppc, while being a
> RELA target, the addend is also stored in the section contents. This
> can be fixed by using the RELA addend in preference to the value read
> from the section, which I believe is correct for all RELA targets. On
That's right. I believe this was also recently changed for PPC...
> m68k, where I initially tested this, the section contents are zeroed,
> so the bug does not occur. The other problem occurs when reusing a
> previously read compilation unit, in which case the section pointer in
> struct dwarf2_debug may be pointing to an unrelated section or can
> even be NULL (when all debug section have already been read). I
> haven't yet found an easy way to solve that properly.
It seems that the easiest way to avoid all this hassle would be to fix
bfd_simple_get_relocated_section_contents to work while linking. This
was one of the uses it's intended for, I just hadn't figured out how to
make it work yet. Probably you can solve most of the problem by saving
and restoring the section output offsets, output sections, and
reloc_done value within that function.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Binutils
mailing list