tools bpftool: Fix compilation error with new binutils 66/292166/1
authorAndres Freund <andres@anarazel.de>
Mon, 1 Aug 2022 01:38:33 +0000 (18:38 -0700)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 28 Apr 2023 06:00:22 +0000 (15:00 +0900)
commitdedbb9a1439d6f5cc837c05c0a00a68db2a03965
treeb8a54af490300d9c6e216a7b9590e1c25bd3a335
parent213727db0b99505da19acf50d5b36a05b2a3b192
tools bpftool: Fix compilation error with new binutils

commit 600b7b26c07a070d0153daa76b3806c1e52c9e00 upstream.

binutils changed the signature of init_disassemble_info(), which now causes
compilation to fail for tools/bpf/bpftool/jit_disasm.c, e.g. on debian
unstable.

Relevant binutils commit:

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

Wire up the feature test and switch to init_disassemble_info_compat(),
which were introduced in prior commits, fixing the compilation failure.

I verified that bpftool can still disassemble bpf programs, both with an
old and new dis-asm.h API. There are no output changes for plain and json
formats. When comparing the output from old binutils (2.35)
to new bintuils with the patch (upstream snapshot) there are a few output
differences, but they are unrelated to this patch. An example hunk is:

     2f: pop    %r14
     31: pop    %r13
     33: pop    %rbx
  -  34: leaveq
  -  35: retq
  +  34: leave
  +  35: ret

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-8-andres@anarazel.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick stable linux-5.15.y commit 4441a9009193 to resolve gcc-12-build issue]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I4bc40a822995acad090f987a2937a6db47a6f511
tools/bpf/bpftool/Makefile
tools/bpf/bpftool/jit_disasm.c