[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241024230622.GC1382412@google.com>
Date: Thu, 24 Oct 2024 23:06:22 +0000
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Matthew Maurer <mmaurer@...gle.com>
Cc: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Naveen N Rao <naveen@...nel.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Petr Pavlu <petr.pavlu@...e.com>,
Daniel Gomez <da.gomez@...sung.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas@...sle.eu>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
linux-modules@...r.kernel.org, linux-kbuild@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v7 3/3] rust: Use gendwarfksyms + extended modversions
for CONFIG_MODVERSIONS
On Wed, Oct 23, 2024 at 02:31:30AM +0000, Matthew Maurer wrote:
> From: Sami Tolvanen <samitolvanen@...gle.com>
>
> Previously, two things stopped Rust from using MODVERSIONS:
> 1. Rust symbols are occasionally too long to be represented in the
> original versions table
> 2. Rust types cannot be properly hashed by the existing genksyms
> approach because:
> * Looking up type definitions in Rust is more complex than C
> * Type layout is potentially dependent on the compiler in Rust,
> not just the source type declaration.
>
> CONFIG_EXTENDED_MODVERSIONS addresses the first point, and
> CONFIG_GENDWARFKSYMS the second. If Rust wants to use MODVERSIONS, allow
> it to do so by selecting both features.
>
> Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com>
> Co-developed-by: Matthew Maurer <mmaurer@...gle.com>
> Signed-off-by: Matthew Maurer <mmaurer@...gle.com>
> ---
> init/Kconfig | 3 ++-
> rust/Makefile | 32 ++++++++++++++++++++++++++++++--
> 2 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index 530a382ee0feb391b4717abdba3672e584a462d0..f5cce579f29b2ed89e97f8075a3bf70e32e71ad0 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1942,7 +1942,8 @@ config RUST
> bool "Rust support"
> depends on HAVE_RUST
> depends on RUST_IS_AVAILABLE
> - depends on !MODVERSIONS
> + select EXTENDED_MODVERSIONS if MODVERSIONS
> + depends on (GENDWARFKSYMS || !MODVERSIONS)
Nit: `depends on !MODVERSIONS || GENDWARFKSYMS` would match the
convention used below.
> +cmd_gendwarfksyms = $(if $(skip_gendwarfksyms),, \
> + $(call rust_exports,$@,"%s\n",$$3) | \
> + scripts/gendwarfksyms/gendwarfksyms \
> + $(if $(KBUILD_SYMTYPES), --symtypes $(@:.o=.symtypes),) \
> + $@ >> $(dot-target).cmd)
Note that Petr suggested adding a KBUILD_ flag for passing the
--stable parameter to gendwarfksyms, which I think would be useful,
so once I send out v5 of that series, we'll have to update this to
also use the parameter when processing Rust objects:
https://lore.kernel.org/linux-modules/8017c328-f039-46c3-b472-f203cd6e2cfe@suse.com/
Sami
Powered by blists - more mailing lists