[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251112160315.2207947-29-alexandre.chartre@oracle.com>
Date: Wed, 12 Nov 2025 17:03:15 +0100
From: Alexandre Chartre <alexandre.chartre@...cle.com>
To: linux-kernel@...r.kernel.org, mingo@...nel.org, jpoimboe@...nel.org,
peterz@...radead.org
Cc: alexandre.chartre@...cle.com
Subject: [PATCH v3 28/28] objtool: Print single line for alternatives with one instruction
When disassembling, if an instruction has alternatives which are all
made of a single instruction then print the original instruction and
alternative instructions on a single line with no header. Alternatives
are described in a comment on the same line, after the different
instructions.
Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
---
tools/objtool/disas.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index 20d64b58182ce..2fc5821acbc3f 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -1012,6 +1012,24 @@ static void *disas_alt(struct disas_context *dctx,
}
alt_count = i;
+ /*
+ * Print default and non-default alternatives.
+ *
+ * If all alternatives have a single instruction then print all
+ * alternatives on a single line. Otherwise, print alternatives
+ * side-by-side with an header and a line for each instruction
+ * of the different alternatives.
+ */
+
+ if (insn_count == 1) {
+ disas_print(stdout, orig_insn->sec, orig_insn->offset, 0, NULL);
+ printf("%s", alts[0].insn[0].str);
+ for (i = 1; i < alt_count; i++)
+ printf(" | %s (%s)", alts[i].insn[0].str, alts[i].name);
+ printf(" # <alternative.%x>\n", alt_id);
+ return orig_insn;
+ }
+
/*
* Print an header with the name of each alternative.
*/
--
2.43.5
Powered by blists - more mailing lists