Re: [PATCH] kbuild: Ignore __this_module in gen_autoksyms.sh
From: Ramji Jiyani
Date: Fri Jun 17 2022 - 14:14:59 EST
On Fri, Jun 17, 2022 at 10:28 AM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> + Sedat
> Re: https://lore.kernel.org/linux-kbuild/CAKwvOdmb5xdF70TzNp=4STCpzkGh16FnuKE1KbdzDhHt=OuRFA@xxxxxxxxxxxxxx/
> In case this helps.
>
> + Ramji
> Ramji, it sounds like you helped test this downstream? If that's the
> case, mind supplying your tested-by tag for the record? Thanks for
> help verifying this change. Thanks too, Steve!
>
> On Thu, Jun 16, 2022 at 12:58 PM Sami Tolvanen <samitolvanen@xxxxxxxxxx> wrote:
> >
> > Module object files can contain an undefined reference to __this_module,
> > which isn't resolved until we link the final .ko. The kernel doesn't
> > export this symbol, so ignore it in gen_autoksyms.sh. This avoids an
> > unnecessary vmlinux rebuild with UNUSED_KSYMS_WHITELIST when we have a
> > symbol list that already contains all the module dependencies.
>
> Worth mentioning that this also fixes a significant build time
> regression made more painful by CONFIG_LTO_CLANG_FULL when using
> CONFIG_UNUSED_KSYMS_WHITELIST.
>
Yes, I tested it and it resolves the build time regression with modules.
Tested-by: Ramji Jiyani <ramjiyani@xxxxxxxxxx>
Thanks,
Ramji
> Thanks for the patch!
> Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
>
> >
> > Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> > ---
> > scripts/gen_autoksyms.sh | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh
> > index faacf7062122..653fadbad302 100755
> > --- a/scripts/gen_autoksyms.sh
> > +++ b/scripts/gen_autoksyms.sh
> > @@ -56,4 +56,7 @@ EOT
> > # point addresses.
> > sed -e 's/^\.//' |
> > sort -u |
> > +# Ignore __this_module. It's not an exported symbol, and will be resolved
> > +# when the final .ko's are linked.
> > +grep -v '^__this_module$' |
> > sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$output_file"
> > --
> > 2.36.1.476.g0c4daa206d-goog
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers