[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251119143247.3944213-24-alexandre.chartre@oracle.com>
Date: Wed, 19 Nov 2025 15:32:40 +0100
From: Alexandre Chartre <alexandre.chartre@...cle.com>
To: linux-kernel@...r.kernel.org, mingo@...nel.org, jpoimboe@...nel.org,
peterz@...radead.org, david.laight.linux@...il.com
Cc: alexandre.chartre@...cle.com
Subject: [PATCH v5 23/30] objtool: Disassemble jump table alternatives
When using the --disas option, also disable jump tables.
Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.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 018aba37b996b..326e16c9f30a8 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",
--
2.43.5
Powered by blists - more mailing lists