[tip: objtool/core] objtool: Disassemble exception table alternatives

tip-bot2 for Alexandre Chartre posted 1 patch 1 week ago
tools/objtool/disas.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
[tip: objtool/core] objtool: Disassemble exception table alternatives
Posted by tip-bot2 for Alexandre Chartre 1 week ago
The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     78df4590c568731cfa12de9ecb888b3b0c141db2
Gitweb:        https://git.kernel.org/tip/78df4590c568731cfa12de9ecb888b3b0c141db2
Author:        Alexandre Chartre <alexandre.chartre@oracle.com>
AuthorDate:    Fri, 21 Nov 2025 10:53:32 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 21 Nov 2025 15:30:14 +01:00

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
---
 tools/objtool/disas.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index 6083a64..018aba3 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -640,6 +640,26 @@ static int disas_alt_add_insn(struct disas_alt *dalt, int index, char *insn_str,
 }
 
 /*
+ * Disassemble an exception table alternative.
+ */
+static int disas_alt_extable(struct disas_alt *dalt)
+{
+	struct instruction *alt_insn;
+	char *str;
+
+	alt_insn = dalt->alt->insn;
+	str = strfmt("resume at 0x%lx <%s+0x%lx>",
+		     alt_insn->offset, alt_insn->sym->name,
+		     alt_insn->offset - alt_insn->sym->offset);
+	if (!str)
+		return -1;
+
+	disas_alt_add_insn(dalt, 0, str, 0);
+
+	return 1;
+}
+
+/*
  * Disassemble an alternative and store instructions in the disas_alt
  * structure. Return the number of instructions in the alternative.
  */
@@ -790,12 +810,16 @@ static void *disas_alt(struct disas_context *dctx,
 		}
 
 		/*
-		 * Only group alternatives are supported at the moment.
+		 * Only group alternatives and exception tables are
+		 * supported at the moment.
 		 */
 		switch (dalt->alt->type) {
 		case ALT_TYPE_INSTRUCTIONS:
 			count = disas_alt_group(dctx, dalt);
 			break;
+		case ALT_TYPE_EX_TABLE:
+			count = disas_alt_extable(dalt);
+			break;
 		default:
 			count = 0;
 		}