[PATCH v3 0/3] x86: Support llvm-objdump in instruction decoder selftest

From: Nathan Chancellor
Date: Wed Nov 29 2023 - 17:18:03 EST


I have taken up this series from Sam to try and drive this forward.

Currently, the instruction decoder selftest does not work with
llvm-objdump because chkobjdump.awk is GNU binutils specific.
chkobjdump.awk can be eliminated altogether because the minimum
supported version of GNU binutils has been bumped to 2.25.

However, with chkobjdump.awk removed, the selftest does not actually
work properly with llvm-objdump:

$ make -skj"$(nproc)" LLVM=1 defconfig
$ scripts/config -e X86_DECODER_SELFTEST
$ make -skj"$(nproc)" LLVM=1 olddefconfig bzImage
...
arch/x86/tools/insn_decoder_test: warning: objdump says 0 bytes, but insn_get_length() says 2
...

Upon inspection it turned out llvm-objdump was formatting its output
differently, which caused objdump_reformat.awk to incorrectly output its
values.

After fixing that bug, a second one was seen where the instruction
"wait" was incorrectly matched with "fwait", which again caused
insn_decoder_test to fail.

Changes in v3:
- Further commit message and cover letter formatting and improvements.
- Add patch 3, which is the ultimate catalyst for the first two changes
- Link to v2: https://lore.kernel.org/r/20221112090418.284656-1-samuelzeter@xxxxxxxxx/

Changes in v2:
- Coding style commit message amendments
- Link to v1: https://lore.kernel.org/r/20220106023606.283953-1-samuelzeter@xxxxxxxxx/

---
Nathan Chancellor (1):
x86/tools: Remove chkobjdump.awk

Samuel Zeter (2):
x86/tools: objdump_reformat.awk: Ensure regex matches fwait
x86/tools: objdump_reformat.awk: Allow for spaces

arch/x86/tools/Makefile | 2 +-
arch/x86/tools/chkobjdump.awk | 34 ----------------------------------
arch/x86/tools/objdump_reformat.awk | 4 ++--
3 files changed, 3 insertions(+), 37 deletions(-)
---
base-commit: 2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
change-id: 20231129-objdump-reformat-llvm-2d71b9f40ac2

Best regards,
--
Nathan Chancellor <nathan@xxxxxxxxxx>