Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3428260pxb; Wed, 13 Oct 2021 05:57:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7EHEQtJlTJQ+ZChhBOLtXQ0yQvGXIayadSoyS7UK2pLuxJCbISfyLppaVivUjBrwQ2K93 X-Received: by 2002:a63:3647:: with SMTP id d68mr12913774pga.315.1634129872437; Wed, 13 Oct 2021 05:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634129872; cv=none; d=google.com; s=arc-20160816; b=LM9IJyvC/IFIeVoZBUtoZ4ilso2hDikosp/OVLSdUYjwgTorrbeZSMGYbkyfWcv+at 0T+t8/bh/dPZBqAGSIQikYzYSkT8jTRfqsb5xn0GWL95RcSuO6UBvh5dTUGT/3a2CK0c 3hBtoHCjQg5TCFOvMM167zAkB4JdX9XZ4XMPb7CY2AmQJfvzeE2YcDXKY4KZpAq70lmZ WVr2ky/HjTm7yc6ZTg72DpaCqfCjoRdg6y+/531je1zaRHnWeb3lV0Z8EufGG22kPcjD 2BKJF8bRTruJBsAAeDvgSTpdcVhr30yZmtpfICcMAUtrDJsmpPr2cBlK4VDnzGBAYR6A 3Y2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=lhMXJ6WblZHJe5mfBpeJXNE2FMlxg7WKQvEx789XACc=; b=Pe/bBNTM8KwYMdY0yBWI3+I5VqYUZt+T/U+DhfVWkCsMSFOuI5jdgy7cIDoWzyN2zD XqOuNllgDkHVwQ8oFqWoFFZaNYV8kgHfiAqeNiNB7/POW2SKNHNFoYOuPuDfEk/IoEd4 n8p55PCgA3LhUd/QPfZgXFhSQDTfDmHrnOvj+nJKZ4Lysoc7dmFFkBKIHmwJKZjIgQBD NN0q1AdTWfU3E01GIdOQdPEv/75+Aitwl+ScCVze99wUlqSOtPaUwSoghQkjYWbEM7uc hQivF4pn8+dLdqkYvz9vkmH1OPJsP8d7oPul+qui9thoPhxdUW1NEmJM2GBDpjhz3waQ KFNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=z8dydKsb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si19853959plo.244.2021.10.13.05.57.38; Wed, 13 Oct 2021 05:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=z8dydKsb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234043AbhJMM6c (ORCPT + 99 others); Wed, 13 Oct 2021 08:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233368AbhJMM6b (ORCPT ); Wed, 13 Oct 2021 08:58:31 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C81C061570; Wed, 13 Oct 2021 05:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lhMXJ6WblZHJe5mfBpeJXNE2FMlxg7WKQvEx789XACc=; b=z8dydKsbniwXTXgDkmitK6D/XA UuBawAGO4qpG/w28f2YxmVEvSKcSsHlORywXRdtxLhBxhYDZvj+YluC1qo5ZsWEryfrBS3LEyt94s zTUSAU9z1B4m+Kd220PWloGGivgPmDPOrw3X7Q2DEkREzdkgqIIujCFdnWzNK5YM3ixDqmatqP7J3 OAw5uWxOfF8vyQJJflZgnMwYepuAX2LmRVHnywPFfsxxZdq11XY1qeWSFhtMD1PZL2vxbNEEJl0lR 4zvoswi4rPnGI7BfiNjnSlDpMfidOAzqVPJzCbr37y2FfZDvJKnO3xb3/6cel4k5dOZCkM+hxzaAF gm9V7MZg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1madnw-00Gi2p-G4; Wed, 13 Oct 2021 12:56:20 +0000 Date: Wed, 13 Oct 2021 05:56:20 -0700 From: Luis Chamberlain To: Huacai Chen Cc: Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Andrew Morton , David Airlie , Jonathan Corbet , Linus Torvalds , linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Yanteng Si , Huacai Chen , Jiaxun Yang , Jessica Yu Subject: Re: [PATCH V5 15/22] LoongArch: Add elf and module support Message-ID: References: <20211013063656.3084555-1-chenhuacai@loongson.cn> <20211013071117.3097969-1-chenhuacai@loongson.cn> <20211013071117.3097969-2-chenhuacai@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013071117.3097969-2-chenhuacai@loongson.cn> Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 03:11:10PM +0800, Huacai Chen wrote: > diff --git a/arch/loongarch/include/asm/vermagic.h b/arch/loongarch/include/asm/vermagic.h > new file mode 100644 > index 000000000000..9882dfd4702a > --- /dev/null > +++ b/arch/loongarch/include/asm/vermagic.h > @@ -0,0 +1,19 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited > + */ > +#ifndef _ASM_VERMAGIC_H > +#define _ASM_VERMAGIC_H > + > +#define MODULE_PROC_FAMILY "LOONGARCH " I take it this not a mips arch? There are other longarchs under arch/mips/include/asm/vermagic.h which is why I ask. > diff --git a/arch/loongarch/kernel/module.c b/arch/loongarch/kernel/module.c > new file mode 100644 > index 000000000000..af7c403b032b > --- /dev/null > +++ b/arch/loongarch/kernel/module.c > @@ -0,0 +1,652 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Author: Hanlu Li > + * Huacai Chen > + * > + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited > + */ > + > +#undef DEBUG Please remove this undef DEBUG line. > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +static int rela_stack_push(s64 stack_value, s64 *rela_stack, size_t *rela_stack_top) > +{ > + if (*rela_stack_top >= RELA_STACK_DEPTH) > + return -ENOEXEC; > + > + rela_stack[(*rela_stack_top)++] = stack_value; > + pr_debug("%s stack_value = 0x%llx\n", __func__, stack_value); If you are going to use pr_debug() so much you may want to add a define for #define pr_fmt(fmt) at the very top. > +int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, > + unsigned int symindex, unsigned int relsec, > + struct module *me) > +{ Nit: Please use struct module *mod, it is much more common in other places. Other than that, this looks fine to me. Reviewed-by: Luis Chamberlain Luis