Re: [PATCH 1/3] modpost: factor out inst location calculation to section_rel()

From: Nick Desaulniers
Date: Fri Jun 23 2023 - 13:01:27 EST


On Thu, Jun 22, 2023 at 10:38 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> On Fri, Jun 23, 2023 at 3:25 AM Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx> wrote:
> >
> > On Tue, Jun 20, 2023 at 5:05 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> 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?
--
Thanks,
~Nick Desaulniers