[PATCH v2] DWARF: Check version >= 3 for DW_FORM_ref_addr

H.J. Lu hjl.tools@gmail.com
Mon Mar 22 13:22:35 GMT 2021


On Thu, Mar 18, 2021 at 6:32 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Thu, Mar 18, 2021 at 06:14:02AM -0700, H.J. Lu wrote:
> > On Wed, Mar 17, 2021 at 11:14 PM Alan Modra <amodra@gmail.com> wrote:
> > >
> > > On Wed, Mar 17, 2021 at 09:25:51PM -0700, H.J. Lu via Binutils wrote:
> > > > --- a/bfd/dwarf2.c
> > > > +++ b/bfd/dwarf2.c
> > > > @@ -3420,10 +3420,14 @@ scan_unit_for_symbols (struct comp_unit *unit)
> > > >         /* Avoid multiple reports of the same missing abbrev.  */
> > > >         if (abbrev_number != previous_failed_abbrev)
> > > >           {
> > > > -           _bfd_error_handler
> > > > -             (_("DWARF error: could not find abbrev number %u"),
> > > > -              abbrev_number);
> > > > +           /* NB: DWARF5 may have references to other CUs.  */
> > > > +           if (unit->version < 5)
> > > > +             _bfd_error_handler
> > > > +               (_("DWARF error: could not find abbrev number %u"),
> > > > +                abbrev_number);
> > > >             previous_failed_abbrev = abbrev_number;
> > > > +           if (unit->version >= 5)
> > > > +             goto skip;
> > > >           }
> > > >         bfd_set_error (bfd_error_bad_value);
> > > >         goto fail;
> > >
> > > This doesn't feel right to me.  Why are we looking for an abbrev in
> > > the wrong CU?  Presumably if the reader can do that, then it might
> > > interpret a lower number abbrev wrongly.
> >
> > Here is the updated patch to replace
> >
> > if (unit->version == 3 || unit->version == 4)
> >
> > with
> >
> > if (unit->version >= 3)
> >
> > for DWARF5 or above.  OK for master?
>
> Yes thanks.
>

I am backporting it to 2.36 branch.

-- 
H.J.


More information about the Binutils mailing list