package/libbpf: fix arm64 build with kernel headers >= 7.3
PATCH 1/1 package/libbpf: fix arm64 build with kernel headers >= 7.3
With kernel headers 7.3, libbpf fails to build on arm64 with glibc:
In file included from [...]/sysroot/usr/include/bits/sigcontext.h:30,
from [...]/sysroot/usr/include/signal.h:301,
from [...]/sysroot/usr/include/sys/param.h:28,
from btf.c:13: [...]/sysroot/usr/include/asm/sigcontext.h:81:9: error: unknown type name '__u128'; did you mean '__u32'?
Linux 7.3 changed arm64's asm/sigcontext.h and asm/ptrace.h to use the __u128 type from linux/types.h. libbpf bundles its own linux/types.h, lacking __u128, which shadows the one from the kernel headers as the build uses -I../include.
Backport the upstream commit adding the __s128 and __u128 typedefs to the bundled header. It is not part of any release yet.
This issue has been present since commit b216661a73f7 ("{toolchain, linux-headers}: add support for 7.3 headers"), which made 7.3 the latest kernel headers version. It only affects master, no release or maintenance branch has 7.3 headers.
Fixes:
https://autobuild.buildroot.org/results/8de59d8e4eb4772a67248f4dade8676486beed8e
--- ...8-bit-integer-types-to-linux-types.h.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 package/libbpf/0001-include-add-128-bit-integer-types-to-linux-types.h.patch
package/libbpf/0001-include-add-128-bit-integer-types-to-linux-types.h.patch new file +36 -0
@@ -0,0 +1,36 @@ +From f90a9c487d7542d91fa584b83b6a624a4fbeb341 Mon Sep 17 00:00:00 2001 +From: Daniel Golle <[email protected]> +Date: Mon, 7 Sep 2026 16:54:26 +0100 +Subject: [PATCH] include: add 128-bit integer types to linux/types.h + +Linux 7.3 declares the fpsimd registers in the arm64 sigcontext as +__u128 instead of __uint128_t, see kernel commit d4bf9e08d412 ("arm64: +uapi: Use __u128 instead of __uint128_t in UAPI headers"). The private +linux/types.h in include/ shadows the kernel's linux/types.h while +building libbpf, so with glibc, whose signal.h pulls in +asm/sigcontext.h, the build fails with an unknown type name __u128. +Add the __s128 and __u128 typedefs as the kernel's uapi and tools +headers define them. + +Upstream: https://github.com/libbpf/libbpf/commit/f90a9c487d7542d91fa584b83b6a624a4fbeb341 +Signed-off-by: Daniel Golle <[email protected]> +--- + include/linux/types.h | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/include/linux/types.h b/include/linux/types.h +index cfb558ac3..3560e9539 100644 +--- a/include/linux/types.h ++++ b/include/linux/types.h +@@ -12,6 +12,11 @@ + #include <asm/types.h> + #include <asm/posix_types.h> + ++#ifdef __SIZEOF_INT128__ ++typedef __signed__ __int128 __s128 __attribute__((aligned(16))); ++typedef unsigned __int128 __u128 __attribute__((aligned(16))); ++#endif ++ + #define __bitwise__ + #define __bitwise __bitwise__ +
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot