From: Cupertino Miranda <cupertino.miranda@oracle.com>
To: binutils@sourceware.org
Cc: jose.marchesi@oracle.com, david.faust@oracle.com,
Cupertino Miranda <cupertino.miranda@oracle.com>
Subject: [PATCH] bpf: Fixed register parsing disambiguating with possible symbol.
Date: Tue, 21 Nov 2023 17:34:47 +0000 [thread overview]
Message-ID: <20231121173447.29928-1-cupertino.miranda@oracle.com> (raw)
This changes parse_bpf_register to detect possible symbols that start with valid
register name, however due some following characters are not.
Also changed the regs-for-symbols-pseudo.s, adding some entries that
should not error if parser is properly detecting the symbol.
---
gas/config/tc-bpf.c | 4 ++++
gas/testsuite/gas/bpf/regs-for-symbols-pseudoc.s | 3 +++
2 files changed, 7 insertions(+)
diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index 45abc3c9578..b6b1db47427 100644
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -1300,6 +1300,10 @@ parse_bpf_register (char *s, char rw, uint8_t *regno)
s += 1;
}
+ /* If we are still parsing a name, it is not a register. */
+ if (is_part_of_name (*s))
+ return NULL;
+
return s;
}
diff --git a/gas/testsuite/gas/bpf/regs-for-symbols-pseudoc.s b/gas/testsuite/gas/bpf/regs-for-symbols-pseudoc.s
index 693787d5479..9b75f275285 100644
--- a/gas/testsuite/gas/bpf/regs-for-symbols-pseudoc.s
+++ b/gas/testsuite/gas/bpf/regs-for-symbols-pseudoc.s
@@ -2,3 +2,6 @@
r2 = r3 ll
r2 = r3+1 ll
r2 = 1+r3 ll
+ r2 = r2d2 ll
+ r2 = r2d2+1 ll
+ r2 = 1+r2d2 ll
--
2.30.2
next reply other threads:[~2023-11-21 17:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 17:34 Cupertino Miranda [this message]
2023-11-21 17:45 ` Jose E. Marchesi
2023-11-21 18:55 ` Cupertino Miranda
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=20231121173447.29928-1-cupertino.miranda@oracle.com \
--to=cupertino.miranda@oracle.com \
--cc=binutils@sourceware.org \
--cc=david.faust@oracle.com \
--cc=jose.marchesi@oracle.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).