From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 162E4C04AA5 for ; Thu, 25 Aug 2022 13:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=T2nK4i/RtoW25Yh+KFgSmqs+/U9Dk5JsyVXa3Lza/Ok=; b=ZfhXOqv6BQc5Zz 3f8/MmBh/ZNt1512OeoCePPxOBIqAC0lM/0id1Moxde4uJz3B9iF7KAmzRPWuUquceYPB8xOzjQtp uH8O9W7tqIeTSQ2CXHN25uPnYgWpqHXZAGQlwqX6PqsM7Vb7dHi8JgtGxcC53FE0QXt+iyNrRQoAn 3Mjt0FgDjmlwsRWqEJ09bCHJBEtkQt1ZBgE0g5ES60s1ylvo8J13HjLNihu9QPcYC2BD97o2KVtD/ ion3sRhvXNbv6KjLXJWHxNkwo7mWJ17SXmfqv1YqUpr6HB+Uw5bnHff8UopHC9a0LDE2JakWVtm3O BVFUPnUTy/aPrPUDJUOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRCmF-00Ej07-0w; Thu, 25 Aug 2022 13:20:07 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRCm8-00Eikd-PN for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 13:20:05 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D3DED6E; Thu, 25 Aug 2022 06:20:03 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.47.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C4DF43F71A; Thu, 25 Aug 2022 06:19:57 -0700 (PDT) Date: Thu, 25 Aug 2022 14:19:55 +0100 From: Mark Rutland To: Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com, andre.przywara@arm.com, catalin.marinas@arm.com, vincenzo.frascino@arm.com, will@kernel.org Subject: Re: [PATCH v1 1/3] arm64: module: move find_section to header Message-ID: References: <20220825102025.53916-1-joey.gouly@arm.com> <20220825102025.53916-2-joey.gouly@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220825102025.53916-2-joey.gouly@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_062000_893845_9335D774 X-CRM114-Status: GOOD ( 18.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 25, 2022 at 11:20:23AM +0100, Joey Gouly wrote: > Move it to the header so that the implementation can be shared > by the alternatives code. > > Signed-off-by: Joey Gouly > Cc: Catalin Marinas > Cc: Will Deacon Acked-by: Mark Rutland Mark. > --- > arch/arm64/include/asm/module.h | 15 +++++++++++++++ > arch/arm64/kernel/module.c | 15 --------------- > 2 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h > index 4e7fa2623896..22f1be47cc92 100644 > --- a/arch/arm64/include/asm/module.h > +++ b/arch/arm64/include/asm/module.h > @@ -65,4 +65,19 @@ static inline bool plt_entry_is_initialized(const struct plt_entry *e) > return e->adrp || e->add || e->br; > } > > +static inline const Elf_Shdr *find_section(const Elf_Ehdr *hdr, > + const Elf_Shdr *sechdrs, > + const char *name) > +{ > + const Elf_Shdr *s, *se; > + const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; > + > + for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) { > + if (strcmp(name, secstrs + s->sh_name) == 0) > + return s; > + } > + > + return NULL; > +} > + > #endif /* __ASM_MODULE_H */ > diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c > index f2d4bb14bfab..76b41e4ca9fa 100644 > --- a/arch/arm64/kernel/module.c > +++ b/arch/arm64/kernel/module.c > @@ -476,21 +476,6 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, > return -ENOEXEC; > } > > -static const Elf_Shdr *find_section(const Elf_Ehdr *hdr, > - const Elf_Shdr *sechdrs, > - const char *name) > -{ > - const Elf_Shdr *s, *se; > - const char *secstrs = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; > - > - for (s = sechdrs, se = sechdrs + hdr->e_shnum; s < se; s++) { > - if (strcmp(name, secstrs + s->sh_name) == 0) > - return s; > - } > - > - return NULL; > -} > - > static inline void __init_plt(struct plt_entry *plt, unsigned long addr) > { > *plt = get_plt_entry(addr, plt); > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel