Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6082696rwb; Mon, 5 Dec 2022 07:47:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf5aX/FlPWJ6nI7HXIvXh8Vrukj+qfLw50hy8ePdkIcug42V5h+gRMR/SkQecT8J2ukZYno8 X-Received: by 2002:a05:6402:2948:b0:463:bc31:2604 with SMTP id ed8-20020a056402294800b00463bc312604mr73900900edb.32.1670255249299; Mon, 05 Dec 2022 07:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670255249; cv=none; d=google.com; s=arc-20160816; b=n3Zp6JRQ/aieAO/UMVoF046CiOuwmiT4kE7qnNAAU/1eDw65DYzkePpnc8goDXz05F 71T+UZDTyHAHken19v10GNRrLeH/rcDdz/OE9EvPPTHK1RGcxLo1UpJrd+w54smAuqnG xWWc+Z5g8V8genWpUGft6ZhXuMa+xu4YZdRwvXoUtdvXInKA5CXadMfTgHecCW8FQ+if ho4pstCxKseSJQMKs71g0DFQf/vOm9ARJhSjcJpQFya4pBT+IB+HeTuWngPoMjI4R2tf GaqN4Raxl1BBDPj/rj4AXZH6+22RQmn1bf14ZX1MQceuD2k3w9O3gXN4jck6ilSsm15b 04aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1z97OrGTU/hJWYAfqZfW/MI++6sXrfXzrMwpvG8EePg=; b=f4PrX2Z1M0IscJw7KtA1C3OhH34uKtRsB98Kna2SoifTrBKz2d83kFw2U5Is16/Elf jUYfBg/pigTHWlERiQzWteqanhqoVzf9zXWPDQ9dd+Q5agC17nNlzfN7REWlyvTbjQlH cZEfPdTx/g70DVKP873kC4SoghBqUbj/paMszvoiyQsNR7hCZDqNNjfVS/ahDHpVVFul 3JlTnY5CuBnx+9I4/E8nEfnHF4IZuzwQZjL3Vy5lt2TfMxojHvz6zznKcyKGhcoYCIkt 8U9BxvZWHDM1AE3mlJ7ioS0xEvC40G/mTo80wg6u9ghmeAK0htBXKl7ZTNSbdbon0Vuz PmwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=dCM178E8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xj7-20020a170906db0700b007ae61d89b28si12203595ejb.977.2022.12.05.07.47.09; Mon, 05 Dec 2022 07:47:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=dCM178E8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232589AbiLEP1c (ORCPT + 81 others); Mon, 5 Dec 2022 10:27:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232819AbiLEP1F (ORCPT ); Mon, 5 Dec 2022 10:27:05 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5291FF4 for ; Mon, 5 Dec 2022 07:25:44 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id b2so28653079eja.7 for ; Mon, 05 Dec 2022 07:25:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1z97OrGTU/hJWYAfqZfW/MI++6sXrfXzrMwpvG8EePg=; b=dCM178E8Suk100QO/ms7b3XLKbOF+8tZvEEe9/zk+YQFvI3lnSe87JvStybbKAIfub awqCa8ezZ4Uu3oKML0aHEtQOrVWM0NOjSyxTARAgBYK/FwVOxscrIDZb0vo9C0F1vhTv CVlVKF5k1rIiSR4jcc1yHO9lBRBOEi2eHTk67Em7XOp7ByTQwljVXxY+ojE4+ei+ajt8 TEkAfU/7OsPg0uqxbXrxu8GBaSxhxorn+jHdkq93jedGn6DJ+7fXOLXWI5Q/4PjAoldP 831OfGZiiaXYkhnPAWplr8SxMrNd9DsxE7ZD4/4GiOHVOhoemq1Qq6Zm+ib+IqnFJXjX Ns7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1z97OrGTU/hJWYAfqZfW/MI++6sXrfXzrMwpvG8EePg=; b=CwjC6cmEv2SLZwj6agODE21MHKD96TnB2FWDGn/4PK4a25Tk3YZv46KjFNj38UTK8j sWJYWVtw5CmcIfONptc1cIW0Jf8xnW6x00qTlX8D1Ov8esBUOUPc3abIqpC4n195o4Bm A3wV/4FmgX4ss1mm9WwNcY4jspKM76LzIJfuNbaoBZQSOeAsePGVDyPpSsdZBAcBe8Ac lPFTqU2xZZ6kNcrLfeXrnq0SUxquTfCsrw81xhxZDwgfWlPSdsnynO/PKNwZKqDIk6KP Ld6hQwd2oxgC9/buhe/MGdYYax3l4oIE7o+fz+3cy9YrI0NCHbkfhTao85gGyY6uSAW0 lUvA== X-Gm-Message-State: ANoB5pmhNM9JBbcKYB7OXL1ar6G8NVFvZMzccSIWN0MYZPf36HzWWmMR mtTVQgMil1GcJSd7B2QCma/4gckO50IzpOw8 X-Received: by 2002:a17:906:94e:b0:7ba:4617:3f17 with SMTP id j14-20020a170906094e00b007ba46173f17mr47839324ejd.226.1670253942928; Mon, 05 Dec 2022 07:25:42 -0800 (PST) Received: from localhost (2001-1ae9-1c2-4c00-748-2a9a-a2a6-1362.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:748:2a9a:a2a6:1362]) by smtp.gmail.com with ESMTPSA id ca13-20020a170906a3cd00b007c08439161dsm6338597ejb.50.2022.12.05.07.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 07:25:42 -0800 (PST) Date: Mon, 5 Dec 2022 16:25:41 +0100 From: Andrew Jones To: Jisheng Zhang Cc: Palmer Dabbelt , Paul Walmsley , Albert Ou , Anup Patel , Atish Patra , Heiko Stuebner , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org Subject: Re: [PATCH v2 08/13] riscv: module: move find_section to module.h Message-ID: <20221205152541.5ahiqvlb7lt6np7w@kamzik> References: <20221204174632.3677-1-jszhang@kernel.org> <20221204174632.3677-9-jszhang@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221204174632.3677-9-jszhang@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 05, 2022 at 01:46:27AM +0800, Jisheng Zhang wrote: > Move it to the header so that the implementation can be shared > by the alternatives code. > > Signed-off-by: Jisheng Zhang > --- > arch/riscv/include/asm/module.h | 15 +++++++++++++++ > arch/riscv/kernel/module.c | 15 --------------- > 2 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/arch/riscv/include/asm/module.h b/arch/riscv/include/asm/module.h > index 76aa96a9fc08..78722a79fc59 100644 > --- a/arch/riscv/include/asm/module.h > +++ b/arch/riscv/include/asm/module.h > @@ -111,4 +111,19 @@ static inline struct plt_entry *get_plt_entry(unsigned long val, > > #endif /* CONFIG_MODULE_SECTIONS */ Should probably add an explicit #include Otherwise Reviewed-by: Andrew Jones Thanks, drew > > +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_RISCV_MODULE_H */ > diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c > index 91fe16bfaa07..76f4b9c2ec5b 100644 > --- a/arch/riscv/kernel/module.c > +++ b/arch/riscv/kernel/module.c > @@ -429,21 +429,6 @@ void *module_alloc(unsigned long size) > } > #endif > > -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; > -} > - > int module_finalize(const Elf_Ehdr *hdr, > const Elf_Shdr *sechdrs, > struct module *me) > -- > 2.37.2 >