public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] bpf: Fixed register parsing disambiguating with possible symbol.
@ 2023-11-21 17:34 Cupertino Miranda
  2023-11-21 17:45 ` Jose E. Marchesi
  0 siblings, 1 reply; 3+ messages in thread
From: Cupertino Miranda @ 2023-11-21 17:34 UTC (permalink / raw)
  To: binutils; +Cc: jose.marchesi, david.faust, Cupertino Miranda

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: Fixed register parsing disambiguating with possible symbol.
  2023-11-21 17:34 [PATCH] bpf: Fixed register parsing disambiguating with possible symbol Cupertino Miranda
@ 2023-11-21 17:45 ` Jose E. Marchesi
  2023-11-21 18:55   ` Cupertino Miranda
  0 siblings, 1 reply; 3+ messages in thread
From: Jose E. Marchesi @ 2023-11-21 17:45 UTC (permalink / raw)
  To: Cupertino Miranda; +Cc: binutils, david.faust


Hi Cuper.
The patch is OK.
Thanks!

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: Fixed register parsing disambiguating with possible symbol.
  2023-11-21 17:45 ` Jose E. Marchesi
@ 2023-11-21 18:55   ` Cupertino Miranda
  0 siblings, 0 replies; 3+ messages in thread
From: Cupertino Miranda @ 2023-11-21 18:55 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: binutils, david.faust


Thanks! Committed!

Jose E. Marchesi writes:

> Hi Cuper.
> The patch is OK.
> Thanks!
>
>> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-21 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 17:34 [PATCH] bpf: Fixed register parsing disambiguating with possible symbol Cupertino Miranda
2023-11-21 17:45 ` Jose E. Marchesi
2023-11-21 18:55   ` Cupertino Miranda

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).