[PATCH] as: fix bpf expression parsing regression

Will Hawkins hawkinsw@obs.cr
Mon Feb 19 22:22:37 GMT 2024


On Mon, Feb 19, 2024 at 2:54 PM Jose E. Marchesi
<jose.marchesi@oracle.com> wrote:
>
>
> >>> diff --git a/gas/testsuite/gas/bpf/indcall-badoperand.l b/gas/testsuite/gas/bpf/indcall-badoperand.l
> >>> new file mode 100644
> >>> index 00000000000..d791435a2ac
> >>> --- /dev/null
> >>> +++ b/gas/testsuite/gas/bpf/indcall-badoperand.l
> >>> @@ -0,0 +1,3 @@
> >>> +.*: Assembler messages:
> >>> +.*:7: Error: unrecognized instruction `call %0'
> >>> +.*:7: Error: expected register name, got '%0'
> >>> diff --git a/gas/testsuite/gas/bpf/indcall-badoperand.s b/gas/testsuite/gas/bpf/indcall-badoperand.s
> >>> new file mode 100644
> >>> index 00000000000..cf19c0a56b6
> >>> --- /dev/null
> >>> +++ b/gas/testsuite/gas/bpf/indcall-badoperand.s
> >>> @@ -0,0 +1,8 @@
> >>> +
> >>> +    .text
> >>> +    .align 4
> >>> +main:
> >>> +
> >>> +    mov %r0, 1
> >>> +    call %0
> >>
> >> What is this test supposed to test exactly?
> >
> > Never mind, now that I reread your mail it is pretty obvious.
> >
> > I tried your patch, and I am getting some non-deterministic behavior.
> > Assembling indcall-badoperand.s the assembler sometimes emits:
> >
> >   foo.s: Assembler messages:
> >   foo.s:7: Error: unrecognized instruction `call %0'
> >   foo.s:7: Error: expected signed 32-bit displacement
> >
> > and sometimes it emits:
> >
> >   foo.s: Assembler messages:
> >   foo.s:7: Error: unrecognized instruction `call %0'
> >   foo.s:7: Error: expected register name, got '%0'
> >
> > Running under valgrind seems to settle on this latest, and expected,
> > output, so this seems to be a memory problem.  I will apply your patch
> > (on your behalf) only after I find and fix this other bug, or the
> > buildbots will go banana.
>
> Hi Will.
>
> Found the cause and fixed it [1] then applied your patch on your behalf,
> with a slightly modified ChangeLog.
>
> Thank you!
>

Glad that I could help! I really, really enjoy working on FOSS! Thank
you and Nick for being so welcoming!

Can't wait to hear your thoughts on the gcc patch I submitted!

Sincerely,
Will


> [1] b86b514aace19799ea141514e16296fb63a089b3


More information about the Binutils mailing list