lkml.org 
[lkml]   [2021]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V5 15/22] LoongArch: Add elf and module support
Hi, Luis,

On Wed, Oct 13, 2021 at 8:56 PM Luis Chamberlain <mcgrof@kernel.org> wrote:
>
> 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.
Yes, LoongArch is not compatible with MIPS, old Loongson is MIPS and
new Loongson isn't.

>
> > 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@loongson.cn>
> > + * Huacai Chen <chenhuacai@loongson.cn>
> > + *
> > + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited
> > + */
> > +
> > +#undef DEBUG
>
> Please remove this undef DEBUG line.
OK, thanks.

>
> > +
> > +#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.
OK, thanks.

>
> > +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.
>
OK, thanks.

> Other than that, this looks fine to me.
>
> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
>
> Luis

\
 
 \ /
  Last update: 2021-10-14 05:02    [W:0.056 / U:2.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site