From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3820606A323 for ; Wed, 2 Dec 2026 07:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ghoexezH Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4jfV8M496tz2xdY; Wed, 02 Dec 2026 18:42:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796197331; cv=none; b=K8EodO1OwkV7/+6IfNQ844UcJgS7O3GVJz0KvUXWoMpBZDPav4vCJEC2H4P4Iy/35jILcES8BCNJhE08EOPOH65CskguBYJskjhpifGwWocZk7Da0gTyrqDgkrFn2AS0x9rScTkXhMVz0rPNtGS05zo6npWfnRvkXf6XTXFY0CM3v2TW2LnwZWuUKfoJX3CUOMXzsc36cB/gdGwZdEov5P8Q/a801Ji1ewiWcgX/pXu/YtbTywSy6l5q0SQSKYF1UsN8qpZVjCt5jMhSyfThO4d9rb6TtugT3L8VG/VibngpbziquxFZZUxeZ44W1ONEY7mIAORiucxjd4UZFfi3PQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1796197331; c=relaxed/relaxed; bh=TqRJeWUO7lNlJUoxSLh54t208Pccpijg2F/5veUyKvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HAlGtyj1jjaAWUWjXfGpirzTO/eKbeIrhcyKRU0HRbMEdQrVb/yZmLibY2v3CR0KKLtQLi3/NbUnAtKDz9zgtBXgZxLJcsnZBGJ56bjGxJ/asb+t9hz5LSZhp/zVcOuZbuZs59zk2IXNLVmvhBQH/NUas40iWFERRTVD1t+ioqB0PjxKV//wVLo5K1t4KtN0ibrWmQBg9Ey1OGhkJCIylGFb/JEvOkR9YHZfQZHMzKpdxU6WL8eBKB6mVfTA9302cjFOwATJ8StA+f6ubuDN5WYgFT2HyYf+T9cRNBOP0HupJEG6nZqzkTd3tjoEVxA3t3aBidOJqBplwUeYT2O27Q== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ghoexezH; dkim-atps=neutral; spf=pass (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=shivangu@linux.ibm.com; receiver=lists.ozlabs.org) smtp.mailfrom=linux.ibm.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ghoexezH; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=shivangu@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4jfV8L2MY1z2xLf for ; Wed, 02 Dec 2026 18:42:10 +1100 (AEDT) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B274gTe3987729; Wed, 2 Dec 2026 07:41:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=TqRJeWUO7lNlJUoxS Lh54t208Pccpijg2F/5veUyKvo=; b=ghoexezHdoWu/fDz2knrfYhUpfSNJSe/q FXLu6uAFnFZ+9y3DjFoJQP80FtpDyIi5pFpplM1DAroLVwskbpicZ9zCKQ8Q3rTK m4IIQZifftmsfS43gaV7surBRHK6y+j66X9R5GaAH1iws1hv4gpnWIJHhJWt/tz4 5EcSrYyFfK4KwflenIc7bTcwO23uJGvTeLY69W48okzSO9Re77Q5tG7yzOethRta hdg48HVRWQECEb6zcacVp/wAEimh7Z8nkrZ+g5zkvxQ0ecU6BAkJanRirADWK1nP 6yOMbZQ11SJgSFEDUR6xRXsaBNveq0HVMOsu+6EIAfXazjCTADjaA== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7mckgtk3-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 07:41:54 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B26nESv2799570; Wed, 2 Dec 2026 07:41:53 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j9v5w41sh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 07:41:53 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B27flYr45023588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Dec 2026 07:41:47 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30AB72004E; Wed, 2 Dec 2026 07:41:47 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 31E9720040; Wed, 2 Dec 2026 07:41:39 +0000 (GMT) Received: from shivang.com (unknown [9.67.68.246]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 2 Dec 2026 07:41:38 +0000 (GMT) From: Shivang Upadhyay To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com, sshegde@linux.ibm.com, jpoimboe@kernel.org, peterz@infradead.org, shivangu@linux.ibm.com, ardb@kernel.org, will@kernel.org, sv@linux.ibm.com, joe.lawrence@redhat.com, song@kernel.org, mingo@kernel.org, mbenes@suse.cz Subject: [PATCH v3 04/11] objtool: Pass the objtool_file to arch_support_alt_relocation() Date: Wed, 2 Dec 2026 13:10:51 +0530 Message-ID: <20261202074059.899491-5-shivangu@linux.ibm.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202074059.899491-1-shivangu@linux.ibm.com> References: <20261202074059.899491-1-shivangu@linux.ibm.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , Precedence: list X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDAzMCBTYWx0ZWRfXxxztZ+MMzHc8 AcrKLJmMkN7+/1AzlrIeZ7+noCns7GMTWMXUpCl2rAKYW99o43TD4ysTSP35wkaCJQoPsyS47fA OXTLoWRUBizJGSCdAYouEH0spwzlkCk= X-Authority-Analysis: v=2.4 cv=MtfHeGae c=1 sm=1 tr=0 ts=6b0fcbc2 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=i4KfL23jzo-cmpiMKxQA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDAzMCBTYWx0ZWRfX+0enewx+mjAQ DwwVCXYwFzO+dIopOaf6dtrz3mhTepoVaozmdQpOpWtqw8FtCYXqQnAH2fFEFclme9qraaPrgPy eDME/Ts9rVWnNvdqxuqsk6rEz1qEzpUgDMDZy9dPgDUDHPPVcgJimAqKpdClA7POD0NCHhi3L9N N26LpUF3VHP7tXzAbHU2K0B3BfKKGndaEw3CzoywL4LmoAHVO6WZ2296tM/HqLdxODp+YAtC9wJ i/1bOGGayGvTKt9yJavc7dGgiybvE4tsXyol8yiAJTFb7g4sPs3p6S63dtVa+NDhL5jp49Np8L2 bEEOBub2eCGdnfwluWNcF9rnVKQIJ1HVsaH6VtvJrqCnBJIBzfNyqOTw/uZa5zfjLu1dM3ntf5e S9diW5JkEI3yrDkQzK+wZr7PTYNRSkpZk19vIObMjPSrvx99LZvdm2qUIeDNvgVhv5mNwPOF7lu Fno7A2tVxVNZ65/OdKQ== X-Proofpoint-GUID: 59w2V_1gr2LJ0M18kSU42PFD_Twth8se X-Proofpoint-ORIG-GUID: odvYE_Bgvd3lHyW6zxSj4Ey_MQXnFRYK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_02,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020030 X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 arch_support_alt_relocation() is called for each PC-relative relocation in the replacement code of an alternative. It only gets the special_alt, the instruction and the relocation, which is enough to tell whether an arch can cope with it, but not to act on it: an arch that wants to fix the instruction up has no way to reach the ELF file. Pass the objtool_file along. No functional change. Will be utilized in next patches. Signed-off-by: Shivang Upadhyay --- tools/objtool/arch/loongarch/special.c | 3 ++- tools/objtool/arch/powerpc/special.c | 3 ++- tools/objtool/arch/x86/special.c | 3 ++- tools/objtool/check.c | 2 +- tools/objtool/include/objtool/special.h | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/objtool/arch/loongarch/special.c b/tools/objtool/arch/loongarch/special.c index aba774109437..585ba327fe86 100644 --- a/tools/objtool/arch/loongarch/special.c +++ b/tools/objtool/arch/loongarch/special.c @@ -3,7 +3,8 @@ #include #include -bool arch_support_alt_relocation(struct special_alt *special_alt, +bool arch_support_alt_relocation(struct objtool_file *file, + struct special_alt *special_alt, struct instruction *insn, struct reloc *reloc) { diff --git a/tools/objtool/arch/powerpc/special.c b/tools/objtool/arch/powerpc/special.c index 8f9bf61ca089..2db320796fee 100644 --- a/tools/objtool/arch/powerpc/special.c +++ b/tools/objtool/arch/powerpc/special.c @@ -5,7 +5,8 @@ #include -bool arch_support_alt_relocation(struct special_alt *special_alt, +bool arch_support_alt_relocation(struct objtool_file *file, + struct special_alt *special_alt, struct instruction *insn, struct reloc *reloc) { diff --git a/tools/objtool/arch/x86/special.c b/tools/objtool/arch/x86/special.c index 1e84c81bfcd8..839997915711 100644 --- a/tools/objtool/arch/x86/special.c +++ b/tools/objtool/arch/x86/special.c @@ -62,7 +62,8 @@ void arch_handle_alternative(struct special_alt *alt) prev = alt; } -bool arch_support_alt_relocation(struct special_alt *special_alt, +bool arch_support_alt_relocation(struct objtool_file *file, + struct special_alt *special_alt, struct instruction *insn, struct reloc *reloc) { diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 4ef5bf97d333..357676135680 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1833,7 +1833,7 @@ static int handle_group_alt(struct objtool_file *file, */ alt_reloc = insn_reloc(file, insn); if (alt_reloc && arch_pc_relative_reloc(alt_reloc) && - !arch_support_alt_relocation(special_alt, insn, alt_reloc)) { + !arch_support_alt_relocation(file, special_alt, insn, alt_reloc)) { ERROR_INSN(insn, "unsupported relocation in alternatives section"); return -1; diff --git a/tools/objtool/include/objtool/special.h b/tools/objtool/include/objtool/special.h index 620dbf6cb0e5..eeaed4e62b86 100644 --- a/tools/objtool/include/objtool/special.h +++ b/tools/objtool/include/objtool/special.h @@ -39,7 +39,8 @@ void arch_handle_alternative(struct special_alt *alt); */ bool arch_alt_ignore_new_reloc(struct section *sec, unsigned long offset); -bool arch_support_alt_relocation(struct special_alt *special_alt, +bool arch_support_alt_relocation(struct objtool_file *file, + struct special_alt *special_alt, struct instruction *insn, struct reloc *reloc); struct reloc *arch_find_switch_table(struct objtool_file *file, -- 2.56.1