Skip to content

x86: Support llvm-objdump in instruction decoder selftest

Nathan Chancellor linux-patches lkml llvm 1 version Applied

Status from this message: The following commit has been merged into the x86/build branch of tip:

Get series with b4
b4 am [email protected] change-id 20231129-objdump-reformat-llvm-2d71b9f40ac2

Versions newest first

  1. v3 Latest3 patches 0 repliesApplied

Changes in v3 from the cover letter

- 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/[email protected]/

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3x86/tools: objdump_reformat.awk: Ensure regex matches fwaitarch/x86/tools/objdump_reformat.awk+1 -10 replies
2/3x86/tools: objdump_reformat.awk: Allow for spacesarch/x86/tools/objdump_reformat.awk+1 -10 replies
3/3x86/tools: Remove chkobjdump.awkarch/x86/tools/Makefile arch/x86/tools/chkobjdump.awk+1 -350 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMasami HiramatsuNathan ChancellorKees Cook
1/3A-b T-b R-b T-b
2/3A-b T-b R-b T-b
3/3R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

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

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/[email protected]/

Changes in v2:
- Coding style commit message amendments
- Link to v1: https://lore.kernel.org/r/[email protected]/

---
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,

Signature · 1 line
Nathan Chancellor <[email protected]>