1 From afe3f4c765b17ced23811fe652c7f7adf7a0c0cf Mon Sep 17 00:00:00 2001
2 From: Tony Ambardar <Tony.Ambardar@gmail.com>
3 Date: Mon, 14 Sep 2020 23:05:26 -0700
4 Subject: [PATCH] tools/arch/powerpc: fix EDEADLOCK redefinition errors in
7 A few archs like powerpc have different errno.h values for macros
8 EDEADLOCK and EDEADLK. In code including both libc and linux versions of
9 errno.h, this can result in multiple definitions of EDEADLOCK in the
10 include chain. Definitions to the same value (e.g. seen with mips) do
11 not raise warnings, but on powerpc there are redefinitions changing the
12 value, which raise warnings and errors (with "-Werror").
14 Guard against these redefinitions to avoid build errors like the following,
15 first seen cross-compiling libbpf v5.8.9 for powerpc using GCC 8.4.0 with
18 In file included from ../../arch/powerpc/include/uapi/asm/errno.h:5,
19 from ../../include/linux/err.h:8,
21 ../../include/uapi/asm-generic/errno.h:40: error: "EDEADLOCK" redefined [-Werror]
22 #define EDEADLOCK EDEADLK
24 In file included from toolchain-powerpc_8540_gcc-8.4.0_musl/include/errno.h:10,
26 toolchain-powerpc_8540_gcc-8.4.0_musl/include/bits/errno.h:58: note: this is the location of the previous definition
29 cc1: all warnings being treated as errors
30 make[5]: *** [target-powerpc_8540_musl/bpftools-5.8.9/tools/build/Makefile.build:97: /home/kodidev/openwrt-project/build_dir/target-powerpc_8540_musl/bpftools-minimal/bpftools-5.8.9//libbpf/staticobjs/libbpf.o] Error 1
32 Fixes: 95f28190aa01 ("tools include arch: Grab a copy of errno.h for arch's
34 Fixes: c3617f72036c ("UAPI: (Scripted) Disintegrate arch/powerpc/include/asm")
36 Reported-by: Rosen Penev <rosenp@gmail.com>
37 Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
39 tools/arch/powerpc/include/uapi/asm/errno.h | 1 +
40 1 file changed, 1 insertion(+)
42 diff --git a/tools/arch/powerpc/include/uapi/asm/errno.h b/tools/arch/powerpc/include/uapi/asm/errno.h
43 index cc79856896a1..4ba87de32be0 100644
44 --- a/tools/arch/powerpc/include/uapi/asm/errno.h
45 +++ b/tools/arch/powerpc/include/uapi/asm/errno.h
47 #ifndef _ASM_POWERPC_ERRNO_H
48 #define _ASM_POWERPC_ERRNO_H
51 #include <asm-generic/errno.h>