From: Luis Chamberlain <mcgrof@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Daniel Gomez <da.gomez@samsung.com>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>,
Petr Pavlu <petr.pavlu@suse.com>,
Sami Tolvanen <samitolvanen@google.com>,
linux-arch@vger.kernel.org, linux-modules@vger.kernel.org
Subject: Re: [PATCH v2] kbuild: keep symbols for symbol_get() even with CONFIG_TRIM_UNUSED_KSYMS
Date: Mon, 16 Dec 2024 08:57:57 -0800 [thread overview]
Message-ID: <Z2BcFZ89wCLHm8YW@bombadil.infradead.org> (raw)
In-Reply-To: <20241214105726.92557-1-masahiroy@kernel.org>
On Sat, Dec 14, 2024 at 07:57:20PM +0900, Masahiro Yamada wrote:
> Linus observed that the symbol_request(utf8_data_table) call fails when
> CONFIG_UNICODE=y and CONFIG_TRIM_UNUSED_KSYMS=y.
>
> symbol_get() relies on the symbol data being present in the ksymtab for
> symbol lookups. However, EXPORT_SYMBOL_GPL(utf8_data_table) is dropped
> due to CONFIG_TRIM_UNUSED_KSYMS, as no module references it in this case.
>
> Probably, this has been broken since commit dbacb0ef670d ("kconfig option
> for TRIM_UNUSED_KSYMS").
>
> This commit addresses the issue by leveraging modpost. Symbol names
> passed to symbol_get() are recorded in the special .no_trim_symbol
> section, which is then parsed by modpost to forcibly keep such symbols.
> The .no_trim_symbol section is discarded by the linker scripts, so there
> is no impact on the size of the final vmlinux or modules.
>
> This commit cannot resolve the issue for direct calls to __symbol_get()
> because the symbol name is not known at compile-time.
>
> Although symbol_get() may eventually be deprecated, this workaround
> should be good enough meanwhile.
>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
prev parent reply other threads:[~2024-12-16 16:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-14 10:57 [PATCH v2] kbuild: keep symbols for symbol_get() even with CONFIG_TRIM_UNUSED_KSYMS Masahiro Yamada
2024-12-16 16:57 ` Luis Chamberlain [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z2BcFZ89wCLHm8YW@bombadil.infradead.org \
--to=mcgrof@kernel.org \
--cc=arnd@arndb.de \
--cc=da.gomez@samsung.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
--cc=petr.pavlu@suse.com \
--cc=samitolvanen@google.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).