[PATCH] as: fix bpf expression parsing regression

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


Hi Will.

Thanks for the patch.

> diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
> index 43e098c2a86..86489c72898 100644
> --- a/gas/config/tc-bpf.c
> +++ b/gas/config/tc-bpf.c
> @@ -1240,7 +1240,7 @@ parse_expression (char *s, expressionS *exp)
>    s = input_line_pointer;
>    input_line_pointer = saved_input_line_pointer;
>  
> -  switch (exp->X_op == O_absent || exp_parse_failed)
> +  if (exp->X_op == O_absent || exp_parse_failed)
>      return NULL;

Uoh!  How did that end there... ^^

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

> +    exit



More information about the Binutils mailing list