From nobody Tue Dec 2 02:04:15 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 08006342519 for ; Fri, 21 Nov 2025 09:54:23 +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=1763718865; cv=none; b=i1GITFcrgWcC144BCKcv+lmVzzFE00F7zjsztao2XRWFHL6o+yI6BX0B5BTf78k98aBdW0t8YKPBGDhANzh6qwlWCAIrGj74zFiAALwE+CAXWYNxU82eNy4ia3zHjuVrOi5Lz2wTcI8lGD0NgBc3QNgL6OwfTuxzGSy05SCIZb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763718865; c=relaxed/simple; bh=qxlVETB9k6E9YlB10GmWvaFDDM+MCgrwkRBWIdB62LU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SkqjtWbytN8IDYXiktQ2t+Jo5h3ktm4hnFEn/HnHqiYbam48xNTcGt5xEiK5Tct3Uxq41WIVqtf4i7pgAsw+bYTFzauYvs/JhO9Qj3jq2b6UzHdg3+iGCHLXMwkuycJ1eu1n+2XH0cTSglLszKHSCfh1OLxyZzMw3D1jdAth41Y= 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=cq4G4kZZ; 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="cq4G4kZZ" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5AL1urlw031045; Fri, 21 Nov 2025 09:54:18 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=DDhzv SgDSur0SqFwPxZuqmAIipYf6Nj8GnAsYkfXqV0=; b=cq4G4kZZGBz59Grx2oUeX LuBUXhfPlNckqkSXBBji/I09t3ZnenZ6QR0OnHFxfl3epr+I2I8SBg5dBwi3Grxz pHQe4wc3n0SGQCnEf5g0rC4J1oDYjHBPXwS4j9N1En2qm1aFc/Q2V6mSxv72lVol 4acYjOHkrnq8f4zhl8kFWFdnO52wclld1jd8PzCBfqBQJpQIAuzuhYIpbtezLOnb hPBDYSNVsL4SPwM3sbmXM64ZpxnwLrYU0R2eorj0ld/BaJ4anKUbyL2jPLHxHP1X 71cFLtVzJ92A7ELXtm84+7Hz6OCj6rKXZBRRYj7Pv3oih8yo03cfCkBo1EJtOzG9 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 4aejbc2nes-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Nov 2025 09:54:17 +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 5AL83bqT004518; Fri, 21 Nov 2025 09:54:17 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4aefyd4uts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Nov 2025 09:54:16 +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 5AL9rgUe021648; Fri, 21 Nov 2025 09:54:16 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-19; Fri, 21 Nov 2025 09:54:16 +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 18/30] objtool: Preserve alternatives order Date: Fri, 21 Nov 2025 10:53:28 +0100 Message-ID: <20251121095340.464045-19-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-GUID: _T_Fj4V5x4bwCgs3mYdAl7G1fJu36_BJ X-Authority-Analysis: v=2.4 cv=JZyxbEKV c=1 sm=1 tr=0 ts=692036ca cx=c_pps a=XiAAW1AwiKB2Y8Wsi+sD2Q==:117 a=XiAAW1AwiKB2Y8Wsi+sD2Q==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yPCof4ZbAAAA:8 a=bp1g5Iz1D7c7guLF1_8A:9 X-Proofpoint-ORIG-GUID: _T_Fj4V5x4bwCgs3mYdAl7G1fJu36_BJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE1MDAzMiBTYWx0ZWRfX9DSlPx3TBtiW ELBeISfC93qFVzWlndhzjnzga6RGI19PCcpjK3IKYA2QR8ndytMFfUlt/8LMPmKmDtVYISEQzUC gU8MyTjC0h9+7BBU8K8p8Ke10IvF8Gf5xYMMSMkl3M254Hz6k7lsU0yZKCXJPGhto28Cgz2Mw+2 2/lRg22Aw8g7QgDDhIQUvtGLbh6MQzdWtiCnUyjFeWDX0BkV06XEa8/XTQ7HASigyCI9uM1hy2r lvXA9F+XW1866y9VX1PY7tMBGyIyiVsI7bWQPjd1sGsxGnCXQsC+R1Oz0N+eKi6FOBpN7OFbYbs q1jiPY46RwXQkCGW3Yb1bndZDUTBbl9EDJ/C9ueKDM1EGxtYb3HSR5e9k/nIna586JygK5pMf3i 9QBTjselNL1s1vXu7CjF6c1zMFFWLw== Content-Type: text/plain; charset="utf-8" Preserve the order in which alternatives are defined. Currently objtool stores alternatives in a list in reverse order. Signed-off-by: Alexandre Chartre --- tools/objtool/check.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 5bb932f211f6b..25839c3950a3c 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1942,6 +1942,7 @@ static int add_special_section_alts(struct objtool_fi= le *file) struct special_alt *special_alt, *tmp; enum alternative_type alt_type; struct alternative *alt; + struct alternative *a; =20 if (special_get_alts(file->elf, &special_alts)) return -1; @@ -1994,9 +1995,20 @@ static int add_special_section_alts(struct objtool_f= ile *file) } =20 alt->insn =3D new_insn; - alt->next =3D orig_insn->alts; alt->type =3D alt_type; - orig_insn->alts =3D alt; + alt->next =3D NULL; + + /* + * Store alternatives in the same order they have been + * defined. + */ + if (!orig_insn->alts) { + orig_insn->alts =3D alt; + } else { + for (a =3D orig_insn->alts; a->next; a =3D a->next) + ; + a->next =3D alt; + } =20 list_del(&special_alt->list); free(special_alt); --=20 2.43.5