[PATCH] bpftools: fix compilation under powerpc
Rosen Penev
rosenp at gmail.com
Sun Sep 13 23:30:20 EDT 2020
On Sun, Sep 13, 2020 at 1:56 PM Rosen Penev <rosenp at gmail.com> wrote:
>
> asm/errno.h must be included before errno.h under powerpc.
https://downloads.openwrt.org/snapshots/faillogs/powerpc_464fp/base/bpftools/full/compile.txt
>
> Fixes:
>
> In file included from tools/arch/powerpc/include/uapi/asm/errno.h:5,
> from tools/include/linux/err.h:8,
> from libbpf.c:29:
> tools/include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined
> [-Werror]
> #define EDEADLOCK EDEADLK
>
> In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
> from libbpf.c:26:
> toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this
> is the location of the previous definition
> #define EDEADLOCK 58
>
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
> package/network/utils/bpftools/Makefile | 2 +-
> .../utils/bpftools/patches/010-powerpc.patch | 50 +++++++++++++++++++
> 2 files changed, 51 insertions(+), 1 deletion(-)
> create mode 100644 package/network/utils/bpftools/patches/010-powerpc.patch
>
> diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile
> index 156dc8a4fa..8e40654ca6 100644
> --- a/package/network/utils/bpftools/Makefile
> +++ b/package/network/utils/bpftools/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>
> PKG_NAME:=bpftools
> PKG_VERSION:=5.8.3
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>
> PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz
> PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x
> diff --git a/package/network/utils/bpftools/patches/010-powerpc.patch b/package/network/utils/bpftools/patches/010-powerpc.patch
> new file mode 100644
> index 0000000000..c2a11f9a2e
> --- /dev/null
> +++ b/package/network/utils/bpftools/patches/010-powerpc.patch
> @@ -0,0 +1,50 @@
> +--- a/tools/lib/bpf/btf.c
> ++++ b/tools/lib/bpf/btf.c
> +@@ -7,6 +7,7 @@
> + #include <string.h>
> + #include <fcntl.h>
> + #include <unistd.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <sys/utsname.h>
> + #include <sys/param.h>
> +--- a/tools/lib/bpf/btf_dump.c
> ++++ b/tools/lib/bpf/btf_dump.c
> +@@ -10,6 +10,7 @@
> + #include <stddef.h>
> + #include <stdlib.h>
> + #include <string.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <linux/err.h>
> + #include <linux/btf.h>
> +--- a/tools/lib/bpf/hashmap.c
> ++++ b/tools/lib/bpf/hashmap.c
> +@@ -8,6 +8,7 @@
> + #include <stdint.h>
> + #include <stdlib.h>
> + #include <stdio.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <linux/err.h>
> + #include "hashmap.h"
> +--- a/tools/lib/bpf/libbpf.c
> ++++ b/tools/lib/bpf/libbpf.c
> +@@ -23,6 +23,7 @@
> + #include <unistd.h>
> + #include <endian.h>
> + #include <fcntl.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <ctype.h>
> + #include <asm/unistd.h>
> +--- a/tools/lib/bpf/ringbuf.c
> ++++ b/tools/lib/bpf/ringbuf.c
> +@@ -9,6 +9,7 @@
> + #endif
> + #include <stdlib.h>
> + #include <stdio.h>
> ++#include <asm/errno.h>
> + #include <errno.h>
> + #include <unistd.h>
> + #include <linux/err.h>
> --
> 2.26.2
>
More information about the openwrt-devel
mailing list