[PATCH v2 5/5] tools bpftool: Fix compilation error with new binutils
authorAndres Freund <andres@anarazel.de>
Sun, 3 Jul 2022 21:25:51 +0000 (14:25 -0700)
committerSalvatore Bonaccorso <carnil@debian.org>
Wed, 10 Aug 2022 18:11:48 +0000 (19:11 +0100)
commit14accb99617b8682d90247f8926c84629f49f0a9
tree1b45b6ee41a766853e73876572e7236b7f3a8795
parentb35e60d0704b439c4686c1c75b3f32072492514f
[PATCH v2 5/5] tools bpftool: Fix compilation error with new binutils

Origin: https://lore.kernel.org/lkml/20220703212551.1114923-6-andres@anarazel.de/

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

Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Quentin Monnet <quentin@isovalent.com>
Link: http://lore.kernel.org/lkml/20220622181918.ykrs5rsnmx3og4sv@alap3.anarazel.de
Signed-off-by: Andres Freund <andres@anarazel.de>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name tools-bpftool-fix-compilation-error-with-new-binutils.patch
tools/bpf/bpftool/Makefile
tools/bpf/bpftool/jit_disasm.c