Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kernel posttest] llvm-objdump - unknown command line argument #1130

Closed
ghost opened this issue Aug 17, 2020 · 9 comments
Closed

[kernel posttest] llvm-objdump - unknown command line argument #1130

ghost opened this issue Aug 17, 2020 · 9 comments
Assignees
Labels
[ARCH] x86_64 This bug impacts ARCH=x86_64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LLVM] 13 This bug was fixed in LLVM 13.x [TOOL] llvm-objdump The issue is relevant to LLVM objdump

Comments

@ghost
Copy link

ghost commented Aug 17, 2020

compiling kernel 5.9.-rc1 with LLVM-10 produces

HOSTCC arch/x86/tools/insn_sanity
TEST posttest
llvm-objdump-10: Unknown command line argument '-v'. Try: 'llvm-objdump-10 --help'
llvm-objdump-10: Did you mean '-C'?
TEST posttest
arch/x86/tools/insn_sanity: Success: decoded and checked 1000000 random instructions with 0 errors (seed:0x307cbccf)

@nickdesaulniers
Copy link
Member

In arch/x86/tools/Makefile, there's an invocation of $(OBJDUMP) that uses -v. It can be changed to --version for now.

@nickdesaulniers nickdesaulniers added [ARCH] x86_64 This bug impacts ARCH=x86_64 [BUG] linux A bug that should be fixed in the mainline kernel. [TOOL] llvm-objdump The issue is relevant to LLVM objdump labels Aug 17, 2020
@nickdesaulniers
Copy link
Member

Also, is there a config to enable posttest? Maybe it's new in 5.9, but I've never heard of it before.

@ghost
Copy link
Author

ghost commented Aug 17, 2020

x86 decoder sanity test https://cateee.net/lkddb/web-lkddb/X86_DECODER_SELFTEST.html, has been there for a while

@ghost
Copy link
Author

ghost commented Aug 17, 2020

Having patched that Makefile the output now exhibits

HOSTCC arch/x86/tools/insn_decoder_test
HOSTCC arch/x86/tools/insn_sanity
TEST posttest
TEST posttest
arch/x86/tools/insn_sanity: Success: decoded and checked 1000000 random instructions with 0 errors (seed:0x151b2cfb)

@nathanchance
Copy link
Member

@n8v8R were you planning on sending a patch? If not, I can do so tomorrow.

@ihalip
Copy link

ihalip commented Aug 26, 2020

There are multiple issues here.

  1. obviously, --version parameter should be used for compatibility between the two

  2. LLVM objdump version is not detected anyway, because the checkobjdump.awk script uses a regexp which doesn't match its output. So the script needs to be changed. In addition, LLVM objdump versions 9 to 12 do not correctly recognize/disassemble the 0x40 0x42 bytes, which is a REX prefix appearing twice for some reason (more info here: https://wiki.osdev.org/X86-64_Instruction_Encoding#REX_prefix and http://staffwww.fullcoll.edu/aclifton/cs241/lecture-instruction-format.html). Could be a codegen issue with clang, though.

  3. The LLVM objdump output needs to be reformatted to match what the insn_decoder_test expects. So the objdump_reformat.awk script needs to be changed too.

@nickdesaulniers
Copy link
Member

Reproducible via CONFIG_X86_DECODER_SELFTEST=y on top of defconfig, then building bzImage.
https://reviews.llvm.org/D101483

@nickdesaulniers nickdesaulniers added the [PATCH] Submitted A patch has been submitted for review label Apr 28, 2021
@nickdesaulniers
Copy link
Member

Let's use additional issues to follow up on anything else. It makes it easier to track where we are when there are multiple things going wrong.

@nickdesaulniers nickdesaulniers self-assigned this Apr 28, 2021
nickdesaulniers added a commit to llvm/llvm-project that referenced this issue Apr 30, 2021
Used by the Linux kernel's CONFIG_X86_DECODER_SELFTEST.

Link: ClangBuiltLinux/linux#1130

Reviewed By: MaskRay, jhenderson, rupprecht

Differential Revision: https://reviews.llvm.org/D101483
@nickdesaulniers
Copy link
Member

-v support: https://reviews.llvm.org/rGdde24a87c55f82d8c7b3bf3eafb10f2b9b2b9a01

closing, let's track @ihalip 's sugguestions in #1362 .

@nickdesaulniers nickdesaulniers added [FIXED][LLVM] 13 This bug was fixed in LLVM 13.x and removed [PATCH] Submitted A patch has been submitted for review labels Apr 30, 2021
arichardson pushed a commit to arichardson/llvm-project that referenced this issue Sep 10, 2021
Used by the Linux kernel's CONFIG_X86_DECODER_SELFTEST.

Link: ClangBuiltLinux/linux#1130

Reviewed By: MaskRay, jhenderson, rupprecht

Differential Revision: https://reviews.llvm.org/D101483
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
Used by the Linux kernel's CONFIG_X86_DECODER_SELFTEST.

Link: ClangBuiltLinux/linux#1130

Reviewed By: MaskRay, jhenderson, rupprecht

Differential Revision: https://reviews.llvm.org/D101483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] x86_64 This bug impacts ARCH=x86_64 [BUG] linux A bug that should be fixed in the mainline kernel. [FIXED][LLVM] 13 This bug was fixed in LLVM 13.x [TOOL] llvm-objdump The issue is relevant to LLVM objdump
Projects
None yet
Development

No branches or pull requests

3 participants