From nobody Tue Dec 2 02:30:44 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 D3017285C88 for ; Wed, 19 Nov 2025 14:33:53 +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=1763562835; cv=none; b=m5olX5js/jOlVm3g/JzSPKa1CscFLImaKjX26dGTfcwtMJDkLhWZljjpducyrK+SMkOWqPCk+eDz9ODH+eBl+hBIvkXErkxlQSa5Zm1MVchEa7QNK7HHphCD0bivu+v8AbxYnEb1saV9JBmcFCgib8oRVciTrxViLD0FEC4L0Mc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763562835; c=relaxed/simple; bh=C5sbEHKn6jcm4a+ljXx4lv7bk1N4cK2tB9CmkF4/AxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VQRtUfANKR5qAkYeiDPqtzunJ2YEj3WzPp1ZcEAmzKoSY4xrR6/NftktEsnrvZ1o5lJD757bUTSOK+rqJZTg99iYwuN4B2JnkkveCgbr5D/7z0eUHRrcj/DSRdsScGpNRfMjcOQzjPvABY3msMVw6z+6uh789+u353TbrpqeM44= 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=mlqvIRE7; 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="mlqvIRE7" 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 5AJERCQs010997; Wed, 19 Nov 2025 14:33:17 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=5BxR5 ActR3/A0/oKEIN3mwVnhgUTFl3OMMf2gKjR7Bs=; b=mlqvIRE7dUryDaeBBoqut hxWrnNZSC4Z4Ls8bXTAO8AKc1ogk+XNF2FOLRdJ3vDPddM1t7MknGUqbPxcYNDui g+K+oZczGzadkSq7177F8SBMe8Uv32Q4DhEwpdwpRA8O5eK5opNZbDwPhnwvm8b/ 5i+lhkAGNBOCW/EdK8qsEW+3rzoPKZIKgCj2slfRTYjli7wm0W/WFh4uWPzmFSGQ e8jamifxVp3eaqjOYAt5ZN9gcldQvmX/Vkqd0ejoNeceQ4pZ4eAEy5HecokX2Ex3 K8A2wGeS1Y51kYXp8ixs62zRwzFfyMXGZmz3LBOkFe/GdJXhX8ElCpZ4RKEyNXur A== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4aejbuq14r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Nov 2025 14:33:16 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5AJCn34E002499; Wed, 19 Nov 2025 14:33:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4aefyanrn9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Nov 2025 14:33:14 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 5AJEWnnU022495; Wed, 19 Nov 2025 14:33:14 GMT Received: from laptop-dell-latitude7430.nl.oracle.com (dhcp-10-154-160-110.vpn.oracle.com [10.154.160.110]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4aefyanr5p-14; Wed, 19 Nov 2025 14:33:14 +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 v5 13/30] objtool: Identify the different types of alternatives Date: Wed, 19 Nov 2025 15:32:30 +0100 Message-ID: <20251119143247.3944213-14-alexandre.chartre@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20251119143247.3944213-1-alexandre.chartre@oracle.com> References: <20251119143247.3944213-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-19_04,2025-11-18_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2510240000 definitions=main-2511190116 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE1MDAzMiBTYWx0ZWRfXxSKGvEcTvhPn Rxc1o6/LNZK3bqCbEdqzvD3NCP34dwHmaIwsP9yABVhWMoKbDzZJuOQLp0XNn0rqAAkzvcR2Tko NAZxuzOSt9viEsqsAQ49s/olA2rm4r8XH2dwCgxpsucev+6oMgarbRxEkla/+JO7iped7OC0zg3 F78bPcRZ9DCo4nOzZ+FURXnMQ7SZuic2MTclAZVkP+YolyfQt3bxtWin+UUVgnt90ci4khDeuE2 q7jm9GfyLH/WmIfgq1nyNvFaccZbJqBeqQ/tsh3NElF/gKunRUK6dx2eLDwuWfzWVtsQUbY2nGx dFVR6tcAqroyX0iqK/ZcsfowbEVdkI7NpkzWbANPAmWPSwu2LHkAvjZVuCQkA02kUROqQo5HTPr Ea5LGLi9jR7D7WPNZytzZ16cxG+HuQ== X-Proofpoint-GUID: U3Gq16iYTctk6mHDi82-QpCceyvXRbzx X-Proofpoint-ORIG-GUID: U3Gq16iYTctk6mHDi82-QpCceyvXRbzx X-Authority-Analysis: v=2.4 cv=Rdydyltv c=1 sm=1 tr=0 ts=691dd52c b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yPCof4ZbAAAA:8 a=RDt3PK5YzZswrGw8on0A:9 Content-Type: text/plain; charset="utf-8" Alternative code, including jump table and exception table, is represented with the same struct alternative structure. But there is no obvious way to identify whether the struct represents alternative instructions, a jump table or an exception table. So add a type to struct alternative to clearly identify the type of alternative. Signed-off-by: Alexandre Chartre --- tools/objtool/check.c | 13 ++++++++----- tools/objtool/include/objtool/check.h | 12 ++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index e12dba144731f..20630df83e85c 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -27,11 +27,6 @@ #include #include =20 -struct alternative { - struct alternative *next; - struct instruction *insn; -}; - static unsigned long nr_cfi, nr_cfi_reused, nr_cfi_cache; =20 static struct cfi_init_state initial_func_cfi; @@ -1945,6 +1940,7 @@ static int add_special_section_alts(struct objtool_fi= le *file) struct list_head special_alts; struct instruction *orig_insn, *new_insn; struct special_alt *special_alt, *tmp; + enum alternative_type alt_type; struct alternative *alt; =20 if (special_get_alts(file->elf, &special_alts)) @@ -1980,9 +1976,15 @@ static int add_special_section_alts(struct objtool_f= ile *file) if (handle_group_alt(file, special_alt, orig_insn, &new_insn)) return -1; =20 + alt_type =3D ALT_TYPE_INSTRUCTIONS; + } else if (special_alt->jump_or_nop) { if (handle_jump_alt(file, special_alt, orig_insn, &new_insn)) return -1; + + alt_type =3D ALT_TYPE_JUMP_TABLE; + } else { + alt_type =3D ALT_TYPE_EX_TABLE; } =20 alt =3D calloc(1, sizeof(*alt)); @@ -1993,6 +1995,7 @@ static int add_special_section_alts(struct objtool_fi= le *file) =20 alt->insn =3D new_insn; alt->next =3D orig_insn->alts; + alt->type =3D alt_type; orig_insn->alts =3D alt; =20 list_del(&special_alt->list); diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/= objtool/check.h index fde958683485f..cbf4af58e29b2 100644 --- a/tools/objtool/include/objtool/check.h +++ b/tools/objtool/include/objtool/check.h @@ -38,6 +38,18 @@ struct alt_group { bool ignore; }; =20 +enum alternative_type { + ALT_TYPE_INSTRUCTIONS, + ALT_TYPE_JUMP_TABLE, + ALT_TYPE_EX_TABLE, +}; + +struct alternative { + struct alternative *next; + struct instruction *insn; + enum alternative_type type; +}; + #define INSN_CHUNK_BITS 8 #define INSN_CHUNK_SIZE (1 << INSN_CHUNK_BITS) #define INSN_CHUNK_MAX (INSN_CHUNK_SIZE - 1) --=20 2.43.5