lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251113164917.2563486-29-alexandre.chartre@oracle.com>
Date: Thu, 13 Nov 2025 17:49:17 +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 v4 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ