]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
libbpf: Add __NR_bpf definition for LoongArch
authorTiezhu Yang <yangtiezhu@loongson.cn>
Tue, 26 May 2026 06:39:36 +0000 (14:39 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 28 May 2026 21:38:15 +0000 (14:38 -0700)
LoongArch uses the generic syscall table, where __NR_bpf is defined
as 280 in include/uapi/asm-generic/unistd.h.

To align with other architectures, add the __NR_bpf definition for
LoongArch to avoid a potential compilation failure: "error __NR_bpf
not defined. libbpf does not support your arch."

This is a follow up patch of:

  commit b0c47807d31d ("bpf: Add sparc support to tools and samples.")
  commit bad1926dd2f6 ("bpf, s390: fix build for libbpf and selftest suite")
  commit ca31ca8247e2 ("tools/bpf: fix perf build error with uClibc (seen on ARC)")
  commit e32cb12ff52a ("bpf, mips: Fix build errors about __NR_bpf undeclared")

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260526063936.16769-1-yangtiezhu@loongson.cn
tools/build/feature/test-bpf.c
tools/lib/bpf/bpf.c

index e7a405f83af6ed9ede61d8bf0c7ed7770b17c084..89d59674f39b9afcb7c42b72b6ae171d5e1294e8 100644 (file)
@@ -20,6 +20,8 @@
 #  define __NR_bpf 6319
 # elif defined(__mips__) && defined(_ABI64)
 #  define __NR_bpf 5315
+# elif defined(__loongarch__)
+#  define __NR_bpf 280
 # else
 #  error __NR_bpf not defined. libbpf does not support your arch.
 # endif
index 3cd705802330450abf8eb12beb88dafb87e353e7..bc513aa8f4041fd696cd63e85beea17312ebf24a 100644 (file)
@@ -59,6 +59,8 @@
 #  define __NR_bpf 6319
 # elif defined(__mips__) && defined(_ABI64)
 #  define __NR_bpf 5315
+# elif defined(__loongarch__)
+#  define __NR_bpf 280
 # else
 #  error __NR_bpf not defined. libbpf does not support your arch.
 # endif