[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAST13Ju4XNH6YDiy_QbfV_2wSGzv6-axLhTPwC54qUvfA@mail.gmail.com>
Date: Sat, 24 Jun 2023 17:55:51 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>
Subject: Re: [PATCH 1/3] modpost: factor out inst location calculation to section_rel()
On Sat, Jun 24, 2023 at 2:01 AM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
>
> On Thu, Jun 22, 2023 at 10:38 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
> >
> > On Fri, Jun 23, 2023 at 3:25 AM Nick Desaulniers
> > <ndesaulniers@...gle.com> wrote:
> > >
> > > On Tue, Jun 20, 2023 at 5:05 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
> > > >
> > > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> > > > index 6e0b8be32648..2551ac9d5bd3 100644
> > > > --- a/scripts/mod/modpost.c
> > > > +++ b/scripts/mod/modpost.c
> > > > @@ -1519,17 +1512,20 @@ static void section_rel(struct module *mod, struct elf_info *elf,
> > > > r_sym = ELF_R_SYM(r.r_info);
> > > > #endif
> > > > r.r_addend = 0;
> > > > +
> > > > + loc = sym_get_data_by_offset(elf, fsecndx, r.r_offset);
> > >
> > > Can we compute `loc` only for the three machine types?
> >
> >
> >
> > I believe you can compute the location in the same way for any architecture
> > because it is mentioned in ELF spec.
>
> Sure, but perhaps it's wasted work for other machine types?
I guess you missed the following code:
switch (elf->hdr->e_machine) {
case EM_386:
...
break;
case EM_ARM:
...
break;
case EM_MIPS:
...
break;
default:
fatal("Please add code to calculate addend for this architecture\n");
}
I believe other machines never call this function.
If it occurred, fatal() would immediately errors out,
but I have not heard such a breakage for far.
I believe only i386, mips and arm use REL.
The other architectures are RELA.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists