[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAQXFjoS70nvBRiwFA46qLhCDG52x=MzXqBEc3cUaxYkcw@mail.gmail.com>
Date: Fri, 24 Jun 2022 04:34:27 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Sami Tolvanen <samitolvanen@...gle.com>
Cc: Nicolas Schier <nicolas@...sle.eu>,
Alexander Lobakin <alobakin@...me>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Steve Muckle <smuckle@...gle.com>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kbuild: Ignore __this_module in gen_autoksyms.sh
On Wed, Jun 22, 2022 at 12:37 AM Sami Tolvanen <samitolvanen@...gle.com> wrote:
>
> On Sat, Jun 18, 2022 at 4:01 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
> >
> > On Fri, Jun 17, 2022 at 4:58 AM Sami Tolvanen <samitolvanen@...gle.com> 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.
> >
> > OK, I understand these two sentences.
> >
> > > This avoids an
> > > unnecessary vmlinux rebuild with UNUSED_KSYMS_WHITELIST when we have a
> > > symbol list that already contains all the module dependencies.
> > >
> >
> > I do not understand how this can happen.
> >
> >
> > Can you provide me steps to reproduce it?
>
> This issue only happens when we have a whitelist that already contains
> all the symbols we need to export. As autoksyms.h contains all the
> necessary symbols in the initial vmlinux build, there should be no
> need to link vmlinux again. However, as the code is looking at
> undefined symbols in module .o files before __this_module is resolved,
> adjust_autoksyms.sh thinks that __this_module is still missing and
> triggers a rebuild, without actually changing anything.
>
> I suspect this isn't a common situation, but it does happen when
> building Android kernels, which specify a complete list of exported
> symbols. Linking vmlinux.o takes a while with LTO and we would like to
> avoid performing this step more than once.
>
> Sami
Thanks, confirmed.
But, this patch does not shoot the root cause.
The relink of vmlinux should not happen irrespective of
UNUSED_KSYMS_WHITELIST.
I thought I had fixed this issue long time before, but
actually didn't due to my mistake in
commit 3fdc7d3fe4c0 ("kbuild: link vmlinux only once for
CONFIG_TRIM_UNUSED_KSYMS").
I will pick up this patch anyway, but the re-link of vmlinux
should be addressed by the other patch.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists