[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176397550061.498.1666291751871643598.tip-bot2@tip-bot2>
Date: Mon, 24 Nov 2025 09:11:40 -0000
From: "tip-bot2 for Alexandre Chartre" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Alexandre Chartre <alexandre.chartre@...cle.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: objtool/core] objtool: Disassemble jump table alternatives
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 7e017720aae87dc2ca2471ac295e34e2b240e5f5
Gitweb: https://git.kernel.org/tip/7e017720aae87dc2ca2471ac295e34e2b240e5f5
Author: Alexandre Chartre <alexandre.chartre@...cle.com>
AuthorDate: Fri, 21 Nov 2025 10:53:33 +01:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Fri, 21 Nov 2025 15:30:14 +01:00
objtool: Disassemble jump table alternatives
When using the --disas option, also disassemble jump tables.
Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: Josh Poimboeuf <jpoimboe@...nel.org>
Link: https://patch.msgid.link/20251121095340.464045-24-alexandre.chartre@oracle.com
---
tools/objtool/disas.c | 38 ++++++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index 018aba3..326e16c 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -639,6 +639,34 @@ static int disas_alt_add_insn(struct disas_alt *dalt, int index, char *insn_str,
return 0;
}
+static int disas_alt_jump(struct disas_alt *dalt)
+{
+ struct instruction *orig_insn;
+ struct instruction *dest_insn;
+ char suffix[2] = { 0 };
+ char *str;
+
+ orig_insn = dalt->orig_insn;
+ dest_insn = dalt->alt->insn;
+
+ if (orig_insn->type == INSN_NOP) {
+ if (orig_insn->len == 5)
+ suffix[0] = 'q';
+ str = strfmt("jmp%-3s %lx <%s+0x%lx>", suffix,
+ dest_insn->offset, dest_insn->sym->name,
+ dest_insn->offset - dest_insn->sym->offset);
+ } else {
+ str = strfmt("nop%d", orig_insn->len);
+ }
+
+ if (!str)
+ return -1;
+
+ disas_alt_add_insn(dalt, 0, str, 0);
+
+ return 1;
+}
+
/*
* Disassemble an exception table alternative.
*/
@@ -809,10 +837,7 @@ static void *disas_alt(struct disas_context *dctx,
goto done;
}
- /*
- * Only group alternatives and exception tables are
- * supported at the moment.
- */
+ count = -1;
switch (dalt->alt->type) {
case ALT_TYPE_INSTRUCTIONS:
count = disas_alt_group(dctx, dalt);
@@ -820,8 +845,9 @@ static void *disas_alt(struct disas_context *dctx,
case ALT_TYPE_EX_TABLE:
count = disas_alt_extable(dalt);
break;
- default:
- count = 0;
+ case ALT_TYPE_JUMP_TABLE:
+ count = disas_alt_jump(dalt);
+ break;
}
if (count < 0) {
WARN("%s: failed to disassemble alternative %s",
Powered by blists - more mailing lists