[PATCH] gas: pru: Fix trailing whitespace handling
Dimitar Dimitrov
dimitar@dinux.eu
Thu Aug 15 15:55:59 GMT 2024
On Thu, Aug 15, 2024 at 10:15:36AM +0200, Jan Beulich wrote:
> On 14.08.2024 22:25, Dimitar Dimitrov wrote:
> > With commit 6ae8a30d44f016cafb46a75843b5109316eb1996, arguments followed
> > by a C-style comment ended up with a trailing space. That extra space
> > character confused the PRU register name matching, leading to spurious
> > errors about unrecognized registers. This affected existing code like
> > newlib's setjmp.s for pru.
> >
> > Fix by stripping the trailing whitespace for any argument.
> >
> > Even with 6ae8a30d44f016cafb46a75843b5109316eb1996 reverted, this patch
> > is safe to be applied.
> >
> > Successfully regression-tested with GCC and newlib testsuites for pru-unknown-elf.
> >
> > Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
>
> Okay, albeit preferably with ...
>
> > --- a/gas/config/tc-pru.c
> > +++ b/gas/config/tc-pru.c
> > @@ -1400,7 +1400,7 @@ pru_parse_args (pru_insn_infoS *insn ATTRIBUTE_UNUSED, char *argstr,
> > {
> > char *p;
> > char *end = NULL;
> > - int i;
> > + int i, len;
> > p = argstr;
> > i = 0;
> > bool terminate = false;
> > @@ -1437,6 +1437,13 @@ pru_parse_args (pru_insn_infoS *insn ATTRIBUTE_UNUSED, char *argstr,
> > as_bad (_("too many arguments"));
> > }
> >
> > + /* Strip trailing whitespace. */
> > + len = strlen (parsed_args[i]);
>
> ... len's type changed to size_t for the use here to be appropriate.
Thanks. Pushed with the suggested change.
Regards,
Dimitar
>
> Jan
More information about the Binutils
mailing list