V2 [PATCH] as: Automatically enable DWARF5 support

H.J. Lu hjl.tools@gmail.com
Mon Jan 18 13:36:20 GMT 2021


On Sun, Jan 17, 2021 at 9:57 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Sun, Jan 17, 2021 at 08:00:25AM -0800, H.J. Lu via Binutils wrote:
> > How about this patch to automatically enable DWARF5 support?
>
> > diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
> > index a428370ecca..6c9871cb300 100644
> > --- a/gas/dwarf2dbg.c
> > +++ b/gas/dwarf2dbg.c
> > @@ -551,7 +551,7 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc)
> >    if (loc->line == 0)
> >      return;
> >    if (loc->filenum == 0 && DWARF2_LINE_VERSION < 5)
> > -    return;
> > +    dwarf_level = 5;
> >
> >    /* Don't emit sequences of line symbols for the same line when the
> >       symbols apply to assembler code.  It is necessary to emit
>
> A target may override the default DWARF2_LINE_VERSION, so I think you
> should write something like
>
>   if (loc->filenum == 0 && dwarf_level < 5)
>     dwarf_level = 5;
>   if (loc->filenum == 0 && DWARF2_LINE_VERSION < 5)
>     return;

Fixed.

>
> > @@ -1043,11 +1043,7 @@ dwarf2_directive_filename (void)
> >    num = get_absolute_expression ();
> >
> >    if ((offsetT) num < 1 && DWARF2_LINE_VERSION < 5)
> > -    {
> > -      as_bad (_("file number less than one"));
> > -      ignore_rest_of_line ();
> > -      return NULL;
> > -    }
> > +    dwarf_level = 5;
> >
> >    /* FIXME: Should we allow ".file <N>\n" as an expression meaning
> >       "switch back to the already allocated file <N> as the current
>
> Similarly here, and in any case we shouldn't ignore a negative file
> number.  This should be

Fixed.

>   if (num == 0 && dwarf_level < 5)
>     dwarf_level = 5;
>   if ((offsetT) num < 0 || (num != 0 && DWARF2_LINE_VERSION < 5))
>     {
>       as_bad (_("file number less than one"));
>       ignore_rest_of_line ();
>       return NULL;
>     }
>
> > @@ -1142,10 +1138,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
> >    if (filenum < 1)
> >      {
> >        if (filenum != 0 || DWARF2_LINE_VERSION < 5)
> > -     {
> > -       as_bad (_("file number less than one"));
> > -       return;
> > -     }
> > +     dwarf_level = 5;
> >      }
> >
> >    if (filenum >= (int) files_in_use || files[filenum].filename == NULL)
>
> Similarly.
>

Fixed.

Here is the updated patch.   OK for master?

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-as-Automatically-enable-DWARF5-support.patch
Type: text/x-patch
Size: 3354 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20210118/e327fb92/attachment.bin>


More information about the Binutils mailing list