Open nickdesaulniers opened 2 years ago
@llvm/issue-subscribers-tools-llvm-objdump
This is a generic problem that current framework in LLVM doesn't support emitting prefixes like GCC during disassembling. For example
void main() {
asm("cs;cs;cs;mov %eax, %eax");
}
Compile it to .o and dump with objdump
:
0000000000000000 <main>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 2e 2e 2e 89 c0 cs cs cs mov %eax,%eax
9: 90 nop
a: 5d pop %rbp
b: c3 retq
dump with llvm-objdump
:
0000000000000000 <main>:
0: 55 pushq %rbp
1: 48 89 e5 movq %rsp, %rbp
4: 2e 2e 2e 89 c0 movl %eax, %eax
9: 90 nop
a: 5d popq %rbp
b: c3 retq
I will try to support it.
When the Linux kernel is built with
-mindirect-branch-cs-prefix
https://lore.kernel.org/all/20220817185410.1174782-1-nathan@kernel.org/ I was usingllvm-objdump -d vmlinux
to check that indirect calls to__x86_indirect_thunk_r11
contained thecs
prefix. It looked like they did not, which was surprising. Triple checking with GNU binutils'objdump
, it looks like they are there:You can see the range of bytes in the instruction is correct. cc @phoebewang