From nobody Tue Dec 2 01:48:51 2025 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.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 F080434A78C for ; Fri, 21 Nov 2025 09:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763718876; cv=none; b=uD3MPS/vBnjzaaLiFfe/0xnUAzMAaraa8eir7oDv8X6atcawqyshFCN/ObBEynTXujoGZirmF3XvrUJDNAcT6QSgWYsLEC+6wJjx51vntNVDeWN/2NpZSVCKrY1JJzHzLdIrlQFUleGW6NELKtySeD7rbIL0AHoDvIjtNIGbTsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763718876; c=relaxed/simple; bh=VSRwr8V/7WahARxm0l2cp+eYniyqbnvgBsM9+YC8eYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DN9a7yH7zBEyZV7X5+eedDx+TCqGPi2aTCR+ZH4LBTaZalKn5h3yC2TZtu3xJJ8IWbaMbRLcO30WFzlo/EijqcpFOhxIJTtE3wn5lrmSt8uPkKx05J0kBUChFPXA65cVn5bCRvQ38nEQnxsL+tk7wCb9Ci2jmER6RnIx1Q/u9Ys= 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=GZc3LVC0; arc=none smtp.client-ip=205.220.177.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="GZc3LVC0" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5AL1uHZl001183; Fri, 21 Nov 2025 09:54:27 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=XWd10 3ciLsFUYpP6CbBqCVjgAZ6xGCyk47DuudaL3RY=; b=GZc3LVC04oWB5/ECyNvAk uKBRECWSvjuSSzU/6CmVpTrOizTuBht7j935a7LvMwWge35618l9VmyelHDfeTpV yBHlOB7Bdhp9CwZBqY9VLtNdnowdqgVFzPnSb/HhPMwBQH+FDvLYat+gWeWlXmoD QqyzTShrAp3dP8sstUs4L/MsGOF7l3aS5/Fu+NopezgO+XdQMublyaQb5TI4pzF0 Z7dmn5ZS6B6/D4+RZWKl2A9izI4rvHsY4Cr/M3EzLPanpyJ/QeY2VkbBcMOor12i RKRqWoT4C7IlnLXVgUBJtKN8y+o/76OjHzQElw9pwQE8OQQkiJsfB5nL2VsoYF+P g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4aej90ax0m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Nov 2025 09:54:27 +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 5AL7uBOU004315; Fri, 21 Nov 2025 09:54:26 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4aefyd4uwd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Nov 2025 09:54:26 +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 5AL9rgUo021648; Fri, 21 Nov 2025 09:54:25 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-24; Fri, 21 Nov 2025 09:54:25 +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 23/30] objtool: Disassemble jump table alternatives Date: Fri, 21 Nov 2025 10:53:33 +0100 Message-ID: <20251121095340.464045-24-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-Authority-Analysis: v=2.4 cv=OMAqHCaB c=1 sm=1 tr=0 ts=692036d3 cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yPCof4ZbAAAA:8 a=AdQ-_Nrh4r4Z-zFpdEsA:9 X-Proofpoint-ORIG-GUID: AX4Igz5VEcn_ZM0bvfo9T8w5htNNrPVW X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE1MDAzMSBTYWx0ZWRfX01TxbTD1tiie 0osFJH8KfuE+8HPnA/Uh8BxFZNW6o56MgdYBUpc5ohQuIDEXukz2lyOcSkP/MEuTEKn758UAjX/ 1Jp9vZorg1x27zaDmY+kuHdv7cWhXr4BDSVYVdx6lfQYUR7K2Xxsy8B67cS5EjZ6KXKiU27y0Vc qTo7JYgYjaU82q8xCyRH7/afz5XW+4b3T03uD/raKHFyBd/T5EJs7HTa133XfNKD+i7kC8qniW5 KWx3xFs9snAzaGiuwJo9o0Y9GAKHfnNfx+YvFMqqobwym+woEpphfNucYOtSuTIMQIeNirSZwbb PJNasnTFobRNgfbWZx2X1AvxU753EkFr6/qztzorzdj/XFKZ8rMm6WIxGg1XWBZfwydwOY9zDi5 gG5NcRDaYwviZi58i+jnueSHMIGNcA== X-Proofpoint-GUID: AX4Igz5VEcn_ZM0bvfo9T8w5htNNrPVW Content-Type: text/plain; charset="utf-8" When using the --disas option, also disassemble jump tables. Signed-off-by: Alexandre Chartre --- 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; } =20 +static int disas_alt_jump(struct disas_alt *dalt) +{ + struct instruction *orig_insn; + struct instruction *dest_insn; + char suffix[2] =3D { 0 }; + char *str; + + orig_insn =3D dalt->orig_insn; + dest_insn =3D dalt->alt->insn; + + if (orig_insn->type =3D=3D INSN_NOP) { + if (orig_insn->len =3D=3D 5) + suffix[0] =3D 'q'; + str =3D strfmt("jmp%-3s %lx <%s+0x%lx>", suffix, + dest_insn->offset, dest_insn->sym->name, + dest_insn->offset - dest_insn->sym->offset); + } else { + str =3D 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; } =20 - /* - * Only group alternatives and exception tables are - * supported at the moment. - */ + count =3D -1; switch (dalt->alt->type) { case ALT_TYPE_INSTRUCTIONS: count =3D disas_alt_group(dctx, dalt); @@ -820,8 +845,9 @@ static void *disas_alt(struct disas_context *dctx, case ALT_TYPE_EX_TABLE: count =3D disas_alt_extable(dalt); break; - default: - count =3D 0; + case ALT_TYPE_JUMP_TABLE: + count =3D disas_alt_jump(dalt); + break; } if (count < 0) { WARN("%s: failed to disassemble alternative %s", --=20 2.43.5