On Sat, Nov 02, 2019 at 05:50:02PM +0530, Amit Daniel Kachhap wrote: > On 10/29/19 10:28 PM, Mark Rutland wrote: > > @@ -485,24 +486,33 @@ static const Elf_Shdr *find_section(const Elf_Ehdr *hdr, > > return NULL; > > } > > +int module_init_ftrace_plt(const Elf_Ehdr *hdr, > > + const Elf_Shdr *sechdrs, > > + struct module *mod) > I think this function can be made static as it is not used anywhere. It's only called by module_finalize() below, so making it static makese sense; done. Thanks Mark. > > +{ > > +#if defined(CONFIG_ARM64_MODULE_PLTS) && defined(CONFIG_DYNAMIC_FTRACE) > > + const Elf_Shdr *s; > > + struct plt_entry *plt; > > + > > + s = find_section(hdr, sechdrs, ".text.ftrace_trampoline"); > > + if (!s) > > + return -ENOEXEC; > > + > > + plt = (void *)s->sh_addr; > > + *plt = get_plt_entry(FTRACE_ADDR, plt); > > + mod->arch.ftrace_trampoline = plt; > > +#endif > > + return 0; > > +} > > + > > int module_finalize(const Elf_Ehdr *hdr, > > const Elf_Shdr *sechdrs, > > struct module *me) > > { > > const Elf_Shdr *s; > > - > > s = find_section(hdr, sechdrs, ".altinstructions"); > > if (s) > > apply_alternatives_module((void *)s->sh_addr, s->sh_size); > > -#ifdef CONFIG_ARM64_MODULE_PLTS > > - if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE)) { > > - s = find_section(hdr, sechdrs, ".text.ftrace_trampoline"); > > - if (!s) > > - return -ENOEXEC; > > - me->arch.ftrace_trampoline = (void *)s->sh_addr; > > - } > > -#endif > > - > > - return 0; > > + return module_init_ftrace_plt(hdr, sechdrs, me); > > } > >