<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58201>58201</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llvm-objdump][x86] cs prefixes are not printed for -mindirect-branch-cs-prefix
</td>
</tr>
<tr>
<th>Labels</th>
<td>
tools:llvm-objdump
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nickdesaulniers
</td>
</tr>
</table>
<pre>
When the Linux kernel is built with `-mindirect-branch-cs-prefix`
https://lore.kernel.org/all/20220817185410.1174782-1-nathan@kernel.org/
I was using `llvm-objdump -d vmlinux` to check that indirect calls to `__x86_indirect_thunk_r11` contained the `cs` prefix. It looked like they did not, which was surprising. Triple checking with GNU binutils' `objdump`, it looks like they are there:
```
$ llvm-objdump -d vmlinux | grep __x86_indirect_thunk_r11 | head -n 10
ffffffff8100071c: 2e e8 5e 2a 00 01 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff8100075c: 2e e8 1e 2a 00 01 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810007a2: 2e e8 d8 29 00 01 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff81000e49: 2e e8 31 23 00 01 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810027da: 2e e8 a0 09 00 01 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810030dc: 2e e9 9e 00 00 01 jmp 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810031c8: 2e e8 b2 ff ff 00 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff81003316: 2e e8 64 fe ff 00 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff81003588: 2e e8 f2 fb ff 00 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810035c4: 2e e8 b6 fb ff 00 callq 0xffffffff82003180 <__x86_indirect_thunk_r11>
$ objdump -d vmlinux | grep __x86_indirect_thunk_r11 | head -n 10
ffffffff8100071c: 2e e8 5e 2a 00 01 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff8100075c: 2e e8 1e 2a 00 01 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810007a2: 2e e8 d8 29 00 01 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff81000e49: 2e e8 31 23 00 01 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810027da: 2e e8 a0 09 00 01 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810030dc: 2e e9 9e 00 00 01 cs jmp ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810031c8: 2e e8 b2 ff ff 00 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff81003316: 2e e8 64 fe ff 00 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff81003588: 2e e8 f2 fb ff 00 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
ffffffff810035c4: 2e e8 b6 fb ff 00 cs call ffffffff82003180 <__x86_indirect_thunk_r11>
```
You can see the range of bytes in the instruction is correct.
cc @phoebewang
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1lkuP2zYUhX-NvLmwQVLWwwst0klTBAi6alF0ZVAkZXFMkw5JZWb-fS8lx_YkdjaVDcEPUrzfPVfGwWmdfGv-6ZWF2Cv4ou3wCnvlrTKgA7SDNhFedOwhK8nyoK3UXom4bD23ol-KsDx61elX3M3Ix4x86GM8hiz_kLFPeBnn1Woqt3J-hyvcGHxnhDFS04rWxZqSFaXVuqrZki4tjz232Zq8OzSV_gwvPMAQtN2lboz5dli69lkOhyMsJXw7mNQ97kB0IHol9qiJR_jeNAiEh7SJ92y3r3W5_b61jf1g91tPaTounI1cWyXHmeCKCGl5UroC-BzBOLfHfaP3Kt30BlJLsC5m7Aleei36sdcw-KPXqeEV_OX10aipr6RgHOoff_4NLXYdtQkZq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