[bpf-next] selftests/bpf: Fix build error for LoongArch

Message ID 1676458867-22052-1-git-send-email-yangtiezhu@loongson.cn
State New
Headers
Series [bpf-next] selftests/bpf: Fix build error for LoongArch |

Commit Message

Tiezhu Yang Feb. 15, 2023, 11:01 a.m. UTC
  There exists build error when make -C tools/testing/selftests/bpf/
on LoongArch:

  BINARY   test_verifier
In file included from test_verifier.c:27:
tools/include/uapi/linux/bpf_perf_event.h:14:28: error: field 'regs' has incomplete type
   14 |         bpf_user_pt_regs_t regs;
      |                            ^~~~
make: *** [Makefile:577: tools/testing/selftests/bpf/test_verifier] Error 1
make: Leaving directory 'tools/testing/selftests/bpf'

Add missing uapi header for LoongArch to use the following definition:
typedef struct user_pt_regs bpf_user_pt_regs_t;

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 tools/include/uapi/asm/bpf_perf_event.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 15, 2023, 4:50 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 15 Feb 2023 19:01:07 +0800 you wrote:
> There exists build error when make -C tools/testing/selftests/bpf/
> on LoongArch:
> 
>   BINARY   test_verifier
> In file included from test_verifier.c:27:
> tools/include/uapi/linux/bpf_perf_event.h:14:28: error: field 'regs' has incomplete type
>    14 |         bpf_user_pt_regs_t regs;
>       |                            ^~~~
> make: *** [Makefile:577: tools/testing/selftests/bpf/test_verifier] Error 1
> make: Leaving directory 'tools/testing/selftests/bpf'
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: Fix build error for LoongArch
    https://git.kernel.org/bpf/bpf-next/c/524581d12164

You are awesome, thank you!
  

Patch

diff --git a/tools/include/uapi/asm/bpf_perf_event.h b/tools/include/uapi/asm/bpf_perf_event.h
index d7dfeab..ff52668 100644
--- a/tools/include/uapi/asm/bpf_perf_event.h
+++ b/tools/include/uapi/asm/bpf_perf_event.h
@@ -6,6 +6,8 @@ 
 #include "../../arch/s390/include/uapi/asm/bpf_perf_event.h"
 #elif defined(__riscv)
 #include "../../arch/riscv/include/uapi/asm/bpf_perf_event.h"
+#elif defined(__loongarch__)
+#include "../../arch/loongarch/include/uapi/asm/bpf_perf_event.h"
 #else
 #include <uapi/asm-generic/bpf_perf_event.h>
 #endif