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

objtool: Disassemble exception table alternatives

When using the --disas option, also disassemble exception tables
(EX_TABLE).

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-23-alexandre.chartre@oracle.com

authored by

Alexandre Chartre and committed by
Peter Zijlstra
78df4590 15e7ad86

+25 -1
+25 -1
tools/objtool/disas.c
··· 640 640 } 641 641 642 642 /* 643 + * Disassemble an exception table alternative. 644 + */ 645 + static int disas_alt_extable(struct disas_alt *dalt) 646 + { 647 + struct instruction *alt_insn; 648 + char *str; 649 + 650 + alt_insn = dalt->alt->insn; 651 + str = strfmt("resume at 0x%lx <%s+0x%lx>", 652 + alt_insn->offset, alt_insn->sym->name, 653 + alt_insn->offset - alt_insn->sym->offset); 654 + if (!str) 655 + return -1; 656 + 657 + disas_alt_add_insn(dalt, 0, str, 0); 658 + 659 + return 1; 660 + } 661 + 662 + /* 643 663 * Disassemble an alternative and store instructions in the disas_alt 644 664 * structure. Return the number of instructions in the alternative. 645 665 */ ··· 810 790 } 811 791 812 792 /* 813 - * Only group alternatives are supported at the moment. 793 + * Only group alternatives and exception tables are 794 + * supported at the moment. 814 795 */ 815 796 switch (dalt->alt->type) { 816 797 case ALT_TYPE_INSTRUCTIONS: 817 798 count = disas_alt_group(dctx, dalt); 799 + break; 800 + case ALT_TYPE_EX_TABLE: 801 + count = disas_alt_extable(dalt); 818 802 break; 819 803 default: 820 804 count = 0;