From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796197335; b=NpdiT482J1QQGq9Kkc9pw+Pj+n1CAPycuxGSjk/4vlGBcI4B4EgWkZeD5UMzw8X8l7cW Lpg1VXAG4uelYSjB/QwXvYFvPnQVTlq5yySCA3Mv/b84PrH6crtXvWYbe+YEVRGUwJCxL 6xG2lqo4ooTuNY5UStuXGdi74Bowy+9EkGs6ciY0hIRpEq4cx+9S00QeaJcKa1yEV27GY 53AkJ2MdSFr6glHcM9v2q3CweC78a9I4mM1+PLwcBBoD+KwG4iMMeYhijZEEgUL9Q1t3b fLANXqzFLfmd2gPoNnqCtjyz/CWpdI9dCdpYi2iA0XhyJkaNRiSz2fbB5/1eibmNpbQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796197335; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-TM-AS-GCONF:X-Proofpoint-Reinject: X-Proofpoint-Spam-Info:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=TqRJeWUO7lNlJUoxSLh54t208Pccpijg2F/5veUyKvo=; b=yF20QWwJ8P9fp8bj/pXU4kHYqWrpF0hUMocSdklJfo8UGUI526vf/VI04m5N96CgCNYh KoE1BiNhoF99fNJ3zweAE4nY6/pFfvYNLApAbdxmWgagzzbCuQu+KEd9g0oWQUvlsxfJZ 2TbI7GmTrh0EBaIoyliGBy3kmybXg249waXi0MD6SQowQDnM3933jnqSKNTZ3DkJX9ibZ HMONu2dEilwp3y+pZuLTzpDWd39j3lkiLCd6lxdGowCTbLRpN8lREiNpi0F5onAQxdJy0 pSr0PN1OszLmS/8Zww0+YogYDKUYUYKDn0ailVHYzS00hM+lm7xlAfpWTjwCESh4JjQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=ghoexezH; arc=none smtp.remote-ip=148.163.158.5 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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED2C3606A31A for ; Wed, 2 Dec 2026 07:42:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ED2C3606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com 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 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: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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