[PATCH] as: fix bpf expression parsing regression

Jose E. Marchesi jose.marchesi@oracle.com
Mon Feb 19 18:52:20 GMT 2024



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

>> +    exit


More information about the Binutils mailing list