public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Fangrui Song <i@maskray.me>, Mark Wielaard <mark@klomp.org>,
	Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] as: Automatically enable DWARF5 support
Date: Mon, 18 Jan 2021 16:27:21 +1030	[thread overview]
Message-ID: <20210118055721.GU26219@bubble.grove.modra.org> (raw)
In-Reply-To: <CAMe9rOr+tKDd6c1B+YADsASwu5vKnz6t4Cj1AmPQ96nGiH6sAA@mail.gmail.com>

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;


> @@ -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

  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.

-- 
Alan Modra
Australia Development Lab, IBM

  parent reply	other threads:[~2021-01-18  5:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17  4:48 [PATCH] as: Add a .dwarf_level directive to set the DWARF level H.J. Lu
2021-01-17  6:11 ` Fangrui Song
2021-01-17 16:00   ` [PATCH] as: Automatically enable DWARF5 support H.J. Lu
2021-01-17 18:56     ` Fangrui Song
2021-01-17 19:26       ` H.J. Lu
2021-01-18  5:57     ` Alan Modra [this message]
2021-01-18 13:36       ` V2 " H.J. Lu
2021-01-18 14:23         ` H.J. Lu
2021-01-18 14:34           ` Nick Clifton
2021-01-25 14:04           ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210118055721.GU26219@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=i@maskray.me \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).