[PATCH] gas: fix building tc-bpf.c on s390x
Jan Beulich
jbeulich@suse.com
Fri Apr 28 06:42:32 GMT 2023
On 27.04.2023 14:56, Ilya Leoshkevich via Binutils wrote:
> --- a/gas/config/tc-bpf.c
> +++ b/gas/config/tc-bpf.c
> @@ -885,7 +885,7 @@ get_token (const char **insn, char *token, size_t *tlen)
> } while (0)
>
> const char *str = *insn;
> - char ch, ch2 = 0;
> + signed char ch, ch2 = 0;
But this doesn't make things any better. If you grep for uses of EOF in
gas, you'll find that the corresponding variables typically are of type
int, and that's what I expect you want to use here as well.
> @@ -1362,7 +1362,7 @@ bpf_pseudoc_to_normal_syntax (const char *str, char **errmsg)
> } while (0)
>
> enum bpf_token_type ttype;
> - enum bpf_token_type bpf_endianness,
> + enum bpf_token_type bpf_endianness = BPF_UNKNOWN,
The variable surely wants an initializer, but I'm uncertain whether the
one you picked is suitable. I don't know bpf, but I see only two options:
There is a default endianness, in which case that wants to be the
initializer. Or endianness needs to be specified explicitly before any
of the constructs leading to build_bpf_endianness() may be used. In that
case the initializer chosen is perhaps fine, but the variable then still
having that value would need to be diagnosed. With what you've done we
now end up with an out of bounds array access in build_bpf_endianness().
You would better have Cc-ed the arch maintainer anyway; doing so now.
Jan
More information about the Binutils
mailing list