Re: [PATCH bpf-next] riscv, bpf: fix some compiler error

From: Björn Töpel
Date: Wed Nov 03 2021 - 03:41:18 EST


On Wed, 3 Nov 2021 at 08:26, tongtiangen <tongtiangen@xxxxxxxxxx> wrote:
>

[...]

>
> Adding a function declaration in bpf_jit_comp64.c file cannot fix this compiler error:
>

AFAIK, there are two issues:

1. https://lore.kernel.org/llvm/202110290334.2zdMyRq4-lkp@xxxxxxxxx/
2. https://lore.kernel.org/llvm/202111020610.9oy9Rr0G-lkp@xxxxxxxxx/

1 is a warning when W=1 is enabled (missing prototype from -Wmissing-prototypes)
2 is an error, since the function is not defined when building CONFIG_ARCH_RV32I

You are trying to address both issues in this patch.

> ....
> when CONFIG_BPF_JIT and CONFIG_ARCH_64I is open, There is the following compiler error (W=1):
> error: no previous prototype for 'rv_bpf_fixup_exception'
> ....
>
> To fix this compiler error, you need to make a declaration in a header file, which is also
> the reason for introducing extable.h.
>

No, you don't need the header file. The forward declaration is
sufficient to get rid of the warning, and the adding CONFIG_ARCH_RV64I
fixes the RV32I build.


Björn