From: Andrew Burgess <aburgess@redhat.com>
To: Jan Beulich <jbeulich@suse.com>, Luis Machado <luis.machado@arm.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH v2 2/2] gas: re-work line number tracking for macros and their expansions
Date: Thu, 15 Dec 2022 17:00:48 +0000 [thread overview]
Message-ID: <87len8zjnj.fsf@redhat.com> (raw)
In-Reply-To: <cc4a7df4-ba33-064a-021b-6b2d93b15a21@suse.com>
Jan Beulich <jbeulich@suse.com> writes:
> On 14.12.2022 17:58, Andrew Burgess wrote:
>> Anyway, hopefully the reproducer helps track down the problem.
>
> It did indeed. Below the patch that addresses the issue for me,
> but before committing I will want to run this through the full set
> of tests (after extending the testcase which didn't catch the issue).
>
> Jan
Can confirm that the patch below fixes the gdb.asm/asm-source.exp test
failure that I was seeing.
Thanks,
Andrew
>
> gas: restore Dwarf info generation after macro diagnostic adjustments
>
> While 6fdb723799e2 ("gas: re-work line number tracking for macros and
> their expansions") was meant to leave generated Dwarf as is, it really
> didn't (and the testcase intended to catch that wasn't covering the case
> which broke). Its adjustment to buffer_and_nest() didn't go far enough,
> leading to the "linefile" directive inserted at the top to also be
> processed later in the PR gas/16908 workaround (which clearly isn't
> intended - it's being put there for processing during macro expansion
> only). That unnoticed flaw in turn led me to worked around it by a
> (suspicious to me already at the time) conditional in as_where().
>
> --- a/gas/input-scrub.c
> +++ b/gas/input-scrub.c
> @@ -564,9 +564,6 @@ as_where (unsigned int *linep)
>
> do
> {
> - if (!saved->is_linefile)
> - break;
> -
> if (expansion != expanding_macro)
> /* Nothing. */;
> else if (saved->logical_input_file != NULL
> --- a/gas/macro.c
> +++ b/gas/macro.c
> @@ -120,8 +120,7 @@ buffer_and_nest (const char *from, const
> size_t from_len;
> size_t to_len = strlen (to);
> int depth = 1;
> - size_t line_start = ptr->len;
> - size_t more = get_line (ptr);
> + size_t line_start, more;
>
> if (to_len == 4 && strcasecmp (to, "ENDR") == 0)
> {
> @@ -147,6 +146,8 @@ buffer_and_nest (const char *from, const
> xfree (linefile);
> }
>
> + line_start = ptr->len;
> + more = get_line (ptr);
> while (more)
> {
> /* Try to find the first pseudo op on the line. */
prev parent reply other threads:[~2022-12-15 17:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 10:47 [PATCH v2 0/2] gas: diagnostic improvements for macros Jan Beulich
2022-12-09 10:49 ` [PATCH v2 1/2] Arm: avoid unhelpful uses of .macro in testsuite Jan Beulich
2022-12-09 10:52 ` [PATCH v2 2/2] gas: re-work line number tracking for macros and their expansions Jan Beulich
2022-12-14 14:03 ` Luis Machado
2022-12-14 14:13 ` Luis Machado
2022-12-14 16:00 ` Andrew Burgess
2022-12-14 16:58 ` Andrew Burgess
2022-12-15 8:28 ` Jan Beulich
2022-12-15 10:50 ` Jan Beulich
2022-12-15 17:00 ` Andrew Burgess [this message]
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=87len8zjnj.fsf@redhat.com \
--to=aburgess@redhat.com \
--cc=binutils@sourceware.org \
--cc=jbeulich@suse.com \
--cc=luis.machado@arm.com \
/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).