[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YWbXdEyonDpXJFK2@bombadil.infradead.org>
Date: Wed, 13 Oct 2021 05:56:20 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Huacai Chen <chenhuacai@...ngson.cn>
Cc: Arnd Bergmann <arnd@...db.de>, Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
David Airlie <airlied@...ux.ie>,
Jonathan Corbet <corbet@....net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-arch@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, Xuefeng Li <lixuefeng@...ngson.cn>,
Yanteng Si <siyanteng@...ngson.cn>,
Huacai Chen <chenhuacai@...il.com>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Jessica Yu <jeyu@...nel.org>
Subject: Re: [PATCH V5 15/22] LoongArch: Add elf and module support
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 <lihanlu@...ngson.cn>
> + * Huacai Chen <chenhuacai@...ngson.cn>
> + *
> + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited
> + */
> +
> +#undef DEBUG
Please remove this undef DEBUG line.
> +
> +#include <linux/moduleloader.h>
> +#include <linux/elf.h>
> +#include <linux/mm.h>
> +#include <linux/vmalloc.h>
> +#include <linux/slab.h>
> +#include <linux/fs.h>
> +#include <linux/string.h>
> +#include <linux/kernel.h>
> +
> +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 <mcgrof@...nel.org>
Luis
Powered by blists - more mailing lists