Re: [PATCH v5 21/21] kbuild: implement CONFIG_TRIM_UNUSED_KSYMS without recursion

Masahiro Yamada
2023-05-16T01:42:11Z

On Mon, May 15, 2023 at 12:28 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> When CONFIG_TRIM_UNUSED_KSYMS is enabled, Kbuild recursively traverses
> the directory tree to determine which EXPORT_SYMBOL to trim. If an
> EXPORT_SYMBOL turns out to be unused by anyone, Kbuild begins the
> second traverse, where some source files are recompiled with their
> EXPORT_SYMBOL() tuned into a no-op.
>
> Linus stated negative opinions about this slowness in commits:
>
> - 5cf0fd591f2e ("Kbuild: disable TRIM_UNUSED_KSYMS option")
> - a555bdd0c58c ("Kbuild: enable TRIM_UNUSED_KSYMS again, with some guarding")
>
> We can do this better now. The final data structures of EXPORT_SYMBOL
> are generated by the modpost stage, so modpost can selectively emit
> KSYMTAB entries that are really used by modules.
>
> Commit 2cce989f8461 ("kbuild: unify two modpost invocations") is another

The commit hash is wrong.

Commit f73edc8951b2 ("kbuild: unify two modpost invocations") is correct.

--
Best Regards
Masahiro Yamada