Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools build: Add feature test for init_disassemble_info API changes

binutils changed the signature of init_disassemble_info(), which now causes
compilation failures for tools/{perf,bpf}, e.g. on debian unstable.

Relevant binutils commit:

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=60a3da00bd5407f07

This commit adds a feature test to detect the new signature. Subsequent
commits will use it to fix the build failures.

Signed-off-by: Andres Freund <andres@anarazel.de>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ben Hutchings <benh@debian.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Quentin Monnet <quentin@isovalent.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
Link: https://lore.kernel.org/r/20220801013834.156015-2-andres@anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Andres Freund and committed by
Arnaldo Carvalho de Melo
cfd59ca9 00b32625

+22
+1
tools/build/Makefile.feature
··· 70 70 libaio \ 71 71 libzstd \ 72 72 disassembler-four-args \ 73 + disassembler-init-styled \ 73 74 file-handle 74 75 75 76 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
+4
tools/build/feature/Makefile
··· 18 18 test-libbfd.bin \ 19 19 test-libbfd-buildid.bin \ 20 20 test-disassembler-four-args.bin \ 21 + test-disassembler-init-styled.bin \ 21 22 test-reallocarray.bin \ 22 23 test-libbfd-liberty.bin \ 23 24 test-libbfd-liberty-z.bin \ ··· 247 246 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl 248 247 249 248 $(OUTPUT)test-disassembler-four-args.bin: 249 + $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes 250 + 251 + $(OUTPUT)test-disassembler-init-styled.bin: 250 252 $(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes 251 253 252 254 $(OUTPUT)test-reallocarray.bin:
+4
tools/build/feature/test-all.c
··· 166 166 # include "test-disassembler-four-args.c" 167 167 #undef main 168 168 169 + #define main main_test_disassembler_init_styled 170 + # include "test-disassembler-init-styled.c" 171 + #undef main 172 + 169 173 #define main main_test_libzstd 170 174 # include "test-libzstd.c" 171 175 #undef main
+13
tools/build/feature/test-disassembler-init-styled.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <stdio.h> 3 + #include <dis-asm.h> 4 + 5 + int main(void) 6 + { 7 + struct disassemble_info info; 8 + 9 + init_disassemble_info(&info, stdout, 10 + NULL, NULL); 11 + 12 + return 0; 13 + }