[PATCH v4 16/20] Kbuild: add Rust support

Miguel Ojeda miguel.ojeda.sandonis at gmail.com
Sat Feb 12 07:47:33 PST 2022


Hi Russell,

On Sat, Feb 12, 2022 at 3:17 PM Russell King (Oracle)
<linux at armlinux.org.uk> wrote:
>
> Please don't use CPU_32v6* here.
>
> It probably makes more sense to add a symbol "HAVE_RUST" and have the
> appropriate architecture Kconfig files select HAVE_RUST.

We can do it whatever way arch maintainers prefer, of course. Why
would you prefer one over the other?

> Does Rust support Thumb on ARMv6 and ARMv7 architectures?

Yes, the main backend is LLVM. Some built-in targets and their support
level are listed here, if you want to take a look:

    https://doc.rust-lang.org/nightly/rustc/platform-support.html

There is also a GCC backend in `rustc` [1], which is making good
progress and may eventually give us access to architectures supported
by GCC. Furthermore, a from-scratch Rust frontend for GCC [2] is being
worked on, though this effort will likely take more time to reach a
point where it may be used for the kernel.

[1] https://github.com/rust-lang/rust/tree/master/compiler/rustc_codegen_gcc
[2] https://github.com/Rust-GCC/gccrs

> Please remove every utterance of "default n" from your patch; n is the
> default default which default defaults to, so you don't need to specify
> default n to make the option default to n. It will default to n purely
> because n is the default when no default is specified.

Certainly. I am curious, though: is there a reason for most of the
other 500+ instances in the kernel tree?

> As Rust doesn't support all the architectures that the kernel supports,
> Rust must not be used for core infrastructure.

Yeah, although I am not sure I understand what you are getting at here.

Cheers,
Miguel



More information about the linux-riscv mailing list