f25e9ff917b30b6f057e73382777598342124bfc
[openwrt/staging/dedeckeh.git] /
1 From 598ada195606eb0e577db0487dd59a2536f206ce Mon Sep 17 00:00:00 2001
2 From: Andres Freund <andres@anarazel.de>
3 Date: Sun, 31 Jul 2022 18:38:27 -0700
4 Subject: [PATCH 1/5] tools build: Add feature test for init_disassemble_info
5 API changes
6
7 binutils changed the signature of init_disassemble_info(), which now causes
8 compilation failures for tools/{perf,bpf}, e.g. on debian unstable.
9
10 Relevant binutils commit:
11
12 https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07
13
14 This commit adds a feature test to detect the new signature. Subsequent
15 commits will use it to fix the build failures.
16
17 Signed-off-by: Andres Freund <andres@anarazel.de>
18 Acked-by: Quentin Monnet <quentin@isovalent.com>
19 Cc: Alexei Starovoitov <ast@kernel.org>
20 Cc: Ben Hutchings <benh@debian.org>
21 Cc: Jiri Olsa <jolsa@kernel.org>
22 Cc: Quentin Monnet <quentin@isovalent.com>
23 Cc: Sedat Dilek <sedat.dilek@gmail.com>
24 Cc: bpf@vger.kernel.org
25 Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
26 Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
27 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
28 (cherry picked from commit cfd59ca91467056bb2c36907b2fa67b8e1af9952)
29 ---
30 tools/build/Makefile.feature | 1 +
31 tools/build/feature/Makefile | 4 ++++
32 tools/build/feature/test-all.c | 4 ++++
33 tools/build/feature/test-disassembler-init-styled.c | 13 +++++++++++++
34 4 files changed, 22 insertions(+)
35 create mode 100644 tools/build/feature/test-disassembler-init-styled.c
36
37 --- a/tools/build/Makefile.feature
38 +++ b/tools/build/Makefile.feature
39 @@ -69,6 +69,7 @@ FEATURE_TESTS_BASIC :=
40 libaio \
41 libzstd \
42 disassembler-four-args \
43 + disassembler-init-styled \
44 file-handle
45
46 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
47 --- a/tools/build/feature/Makefile
48 +++ b/tools/build/feature/Makefile
49 @@ -18,6 +18,7 @@ FILES=
50 test-libbfd.bin \
51 test-libbfd-buildid.bin \
52 test-disassembler-four-args.bin \
53 + test-disassembler-init-styled.bin \
54 test-reallocarray.bin \
55 test-libbfd-liberty.bin \
56 test-libbfd-liberty-z.bin \
57 @@ -239,6 +240,9 @@ $(OUTPUT)test-libbfd-buildid.bin:
58 $(OUTPUT)test-disassembler-four-args.bin:
59 $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
60
61 +$(OUTPUT)test-disassembler-init-styled.bin:
62 + $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
63 +
64 $(OUTPUT)test-reallocarray.bin:
65 $(BUILD)
66
67 --- a/tools/build/feature/test-all.c
68 +++ b/tools/build/feature/test-all.c
69 @@ -166,6 +166,10 @@
70 # include "test-disassembler-four-args.c"
71 #undef main
72
73 +#define main main_test_disassembler_init_styled
74 +# include "test-disassembler-init-styled.c"
75 +#undef main
76 +
77 #define main main_test_libzstd
78 # include "test-libzstd.c"
79 #undef main
80 --- /dev/null
81 +++ b/tools/build/feature/test-disassembler-init-styled.c
82 @@ -0,0 +1,13 @@
83 +// SPDX-License-Identifier: GPL-2.0
84 +#include <stdio.h>
85 +#include <dis-asm.h>
86 +
87 +int main(void)
88 +{
89 + struct disassemble_info info;
90 +
91 + init_disassemble_info(&info, stdout,
92 + NULL, NULL);
93 +
94 + return 0;
95 +}