Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Compact output for alternatives with one instruction

When disassembling, if an instruction has alternatives which are all
made of a single instruction then print each alternative on a single
line (instruction + description) so that the output is more compact.

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/20251121095340.464045-29-alexandre.chartre@oracle.com

authored by

Alexandre Chartre and committed by
Peter Zijlstra
07d70b27 56967b9a

+22
+22
tools/objtool/disas.c
··· 863 863 int alt_count, int insn_count) 864 864 { 865 865 struct instruction *orig_insn; 866 + int width; 866 867 int i, j; 867 868 int len; 868 869 ··· 871 870 872 871 len = disas_print(stdout, orig_insn->sec, orig_insn->offset, 0, NULL); 873 872 printf("%s\n", alt_name); 873 + 874 + /* 875 + * If all alternatives have a single instruction then print each 876 + * alternative on a single line. Otherwise, print alternatives 877 + * one above the other with a clear separation. 878 + */ 879 + 880 + if (insn_count == 1) { 881 + width = 0; 882 + for (i = 0; i < alt_count; i++) { 883 + if (dalts[i].width > width) 884 + width = dalts[i].width; 885 + } 886 + 887 + for (i = 0; i < alt_count; i++) { 888 + printf("%*s= %-*s (if %s)\n", len, "", width, 889 + dalts[i].insn[0].str, dalts[i].name); 890 + } 891 + 892 + return; 893 + } 874 894 875 895 for (i = 0; i < alt_count; i++) { 876 896 printf("%*s= %s\n", len, "", dalts[i].name);