Re: [RFC PATCH 1/1] scripts: Build per module Rust crates

From: Martin Rodriguez Reboredo
Date: Sun Oct 22 2023 - 20:46:21 EST


On 10/22/23 13:21, Masahiro Yamada wrote:
On Sat, Oct 7, 2023 at 12:57 AM Martin Rodriguez Reboredo
<yakoyoku@xxxxxxxxx> wrote:

Enables compiling Rust crates as dependencies of kernel modules.

When a composite object depends on an `.rlib` file, which by the way is
a current ar archive, Kbuild will compile it from its base Rust source
and link it.

This makes possible to have Rust bindings for a subsystem that is
compiled as a module.

Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@xxxxxxxxx>


I could not understand how this will work because
there is no explanation how to use *.rlib in the later
build steps.

If I understand correctly, does this intend to link *.rlib
as a part of modules?

Yes, the purpose of this RFC is to link the *.rlib, its members
specifically, as part of modules to avoid the scenario of having
Rust bindings linked statically and their C counterparts dynamically.

I'll write a v2 that'll clarify its usage. I've made more progress
locally and had run tests with success.