Re: [PATCH v3] kbuild: Fix TRIM_UNUSED_KSYMS with LTO_CLANG

From: Sami Tolvanen
Date: Mon Aug 16 2021 - 14:07:10 EST


On Sat, Aug 14, 2021 at 4:27 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> On Fri, Aug 13, 2021 at 6:46 AM 'Sami Tolvanen' via Clang Built Linux
> <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
> >
> > With CONFIG_LTO_CLANG, we currently link modules into native
> > code just before modpost, which means with TRIM_UNUSED_KSYMS
> > enabled, we still look at the LLVM bitcode in the .o files when
> > generating the list of used symbols. As the bitcode doesn't
> > yet have calls to compiler intrinsics and llvm-nm doesn't see
> > function references that only exist in function-level inline
> > assembly, we currently need a whitelist for TRIM_UNUSED_KSYMS to
> > work with LTO.
> >
> > This change moves module LTO linking to happen earlier, and
> > thus avoids the issue with LLVM bitcode and TRIM_UNUSED_KSYMS
> > entirely, allowing us to also drop the whitelist from
> > gen_autoksyms.sh.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1369
> > Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> > Reviewed-by: Alexander Lobakin <alobakin@xxxxx>
> > Tested-by: Alexander Lobakin <alobakin@xxxxx>
> > ---
> > Changes in v3:
> > - Added missing FORCE.
>
>
>
> All the modules are recompiled every time.

Oops, .lto.o is missing from targets still, which breaks if_changed.
Fixed in v4. Thanks for testing!

Sami