From nobody Tue Dec 2 01:49:04 2025 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC7E934B1A6 for ; Fri, 21 Nov 2025 09:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763718884; cv=none; b=jVxpFQs4vxZ1g782va3ajOuSfBJZ/ozxQm+fRaLyYqASGyVkDFYAcMzYVcdxA27U/M/mm20MRvkLsLtKKrtV+SPIK/Pgj/9oM0+sj4g5UNzn2lSAiU4ul8+UWV2l/A8lh/jAirgpCDs/l9b86ZaY0CIa9QmkH81axln6cjSP9uw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763718884; c=relaxed/simple; bh=bJrU0v15i68NWxbfSFEiqQ6IK3kd0rHoV26uN49ZtLY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nsVDpfHW53fykl42vlqwCgeOIal8O1E7Ntor2eLl4BZUsek7JdI84NFwpWn9ODMPv8MyIECTh+cizxSjROLcqMb8bJo2PCGct36lrwZ9Khqc84UHf5cdl40k0tAg9iy/Jn7SMAyiHz4wjHS+s27Df/RP+FNj73IR0nxyUHuQsNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=jPUpdLK5; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jPUpdLK5" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5AL1vTu6032720; Fri, 21 Nov 2025 09:54:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=gDFAF NT+czOlxrsSeEW+rT6Hi2+OtuUa9itEXh07WtY=; b=jPUpdLK5zh6BWVHeY5yde mrQnK6+jZPugtZfTyDzhOF+Ha/6IO9t3wBOQo8Mw1JbyCFfIT7KfDasp8tS2lUKH QayFBgdMaO9LD8GA/t2zzqoZoZ/m/chyED+z2tZT+SCKfC0mEfkjO+TaRccK5xAz kYmwF2FrpNtmrW9UN6cKsmdBEAhJlIdQTSgK0QxsiO0APC4Yubm30k7vsr73ylNp 2TFGK39mXH8gYX4+ctRNzEAjDPdW9I9HQ8dMySkF4l0bNkFl04op9J5PMExbfy+O 3yVOHO5MqXeYCPpkhuhaxxHHcQWxXHnwxh0d/XtpxsUba8q3kNtgmTcislWXCHyA A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4aejbutn83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Nov 2025 09:54:36 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5AL9sED4004512; Fri, 21 Nov 2025 09:54:35 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4aefyd4v0y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Nov 2025 09:54:35 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 5AL9rgV0021648; Fri, 21 Nov 2025 09:54:35 GMT Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-175-150.vpn.oracle.com [10.154.175.150]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4aefyd4ub2-29; Fri, 21 Nov 2025 09:54:34 +0000 From: Alexandre Chartre To: linux-kernel@vger.kernel.org, mingo@kernel.org, jpoimboe@kernel.org, peterz@infradead.org, david.laight.linux@gmail.com Cc: alexandre.chartre@oracle.com Subject: [PATCH v6 28/30] objtool: Compact output for alternatives with one instruction Date: Fri, 21 Nov 2025 10:53:38 +0100 Message-ID: <20251121095340.464045-29-alexandre.chartre@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20251121095340.464045-1-alexandre.chartre@oracle.com> References: <20251121095340.464045-1-alexandre.chartre@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-21_03,2025-11-20_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2510240000 definitions=main-2511210075 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE1MDAzMiBTYWx0ZWRfX2WmdVENsKvat 0dMLjiTP5/BaDCau+ATC8trPgvBQzajJEBdGmmAweNjTAzQMbCG0tMghj3KGnG07DYCEPVjQco6 fcs4JWqbyWmh58zx6gsODbcLfCO3d8NV9Q7X3y8u6iiRrv/vckD/0EmhM/sE0DdYRfFWYAU7wrX pp9QnwX36TxKY2bG5xhE35Ih+ihsBK0uEddrYGMUwJ6tlG/CKegMd7bFl5rbHfDI+u+ZCSRmpMA U0DBa/MdQAct8pPE/pLfi9PTfpKWs/dHc+cEJ8j2dN04GKjY2rqXNWfecRMcmLks2RCbJ6m4i/n vTCXEjHpxPXvKucfdrPV1w9Hxc2SwNBhr/2EENVvUbc4R0SC95f2GdBQz/GSFcUve5J6hy/yWC3 0PzKjBkRTXeltnKGOHGp+s1MKnuLfA== X-Proofpoint-GUID: jtuzeD0kLBzle-2LEKX7HKc-rkxq4fkG X-Proofpoint-ORIG-GUID: jtuzeD0kLBzle-2LEKX7HKc-rkxq4fkG X-Authority-Analysis: v=2.4 cv=Rdydyltv c=1 sm=1 tr=0 ts=692036dc cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yPCof4ZbAAAA:8 a=eaZXao46RdKAZoVW1j8A:9 Content-Type: text/plain; charset="utf-8" When disassembling, if an instruction has alternatives which are all made of a single instruction then print each alternative on a single line (instruction + description) so that the output is more compact. Signed-off-by: Alexandre Chartre --- tools/objtool/disas.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c index 731c4495b53c7..a4f905eac4e63 100644 --- a/tools/objtool/disas.c +++ b/tools/objtool/disas.c @@ -863,6 +863,7 @@ static void disas_alt_print_compact(char *alt_name, str= uct disas_alt *dalts, int alt_count, int insn_count) { struct instruction *orig_insn; + int width; int i, j; int len; =20 @@ -871,6 +872,27 @@ static void disas_alt_print_compact(char *alt_name, st= ruct disas_alt *dalts, len =3D disas_print(stdout, orig_insn->sec, orig_insn->offset, 0, NULL); printf("%s\n", alt_name); =20 + /* + * If all alternatives have a single instruction then print each + * alternative on a single line. Otherwise, print alternatives + * one above the other with a clear separation. + */ + + if (insn_count =3D=3D 1) { + width =3D 0; + for (i =3D 0; i < alt_count; i++) { + if (dalts[i].width > width) + width =3D dalts[i].width; + } + + for (i =3D 0; i < alt_count; i++) { + printf("%*s=3D %-*s (if %s)\n", len, "", width, + dalts[i].insn[0].str, dalts[i].name); + } + + return; + } + for (i =3D 0; i < alt_count; i++) { printf("%*s=3D %s\n", len, "", dalts[i].name); for (j =3D 0; j < insn_count; j++) { --=20 2.43.5