lkml.org 
[lkml]   [2022]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v8 27/31] Kbuild: add Rust support
On Tue, Aug 2, 2022 at 10:53 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Having all the new files in place, we now enable Rust support
> in the build system, including `Kconfig` entries related to Rust,
> the Rust configuration printer, the target specification
> generation script, the version detection script and a few
> other bits.
>
> Co-developed-by: Alex Gaynor <alex.gaynor@gmail.com>
> Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com>
> Co-developed-by: Finn Behrens <me@kloenk.de>
> Signed-off-by: Finn Behrens <me@kloenk.de>
> Co-developed-by: Adam Bratschi-Kaye <ark.email@gmail.com>
> Signed-off-by: Adam Bratschi-Kaye <ark.email@gmail.com>
> Co-developed-by: Wedson Almeida Filho <wedsonaf@google.com>
> Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
> Co-developed-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Co-developed-by: Sven Van Asbroeck <thesven73@gmail.com>
> Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
> Co-developed-by: Gary Guo <gary@garyguo.net>
> Signed-off-by: Gary Guo <gary@garyguo.net>
> Co-developed-by: Boris-Chengbiao Zhou <bobo1239@web.de>
> Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
> Co-developed-by: Boqun Feng <boqun.feng@gmail.com>
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> Co-developed-by: Douglas Su <d0u9.su@outlook.com>
> Signed-off-by: Douglas Su <d0u9.su@outlook.com>
> Co-developed-by: Dariusz Sosnowski <dsosnowski@dsosnowski.pl>
> Signed-off-by: Dariusz Sosnowski <dsosnowski@dsosnowski.pl>
> Co-developed-by: Antonio Terceiro <antonio.terceiro@linaro.org>
> Signed-off-by: Antonio Terceiro <antonio.terceiro@linaro.org>
> Co-developed-by: Daniel Xu <dxu@dxuuu.xyz>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> Co-developed-by: Miguel Cano <macanroj@gmail.com>
> Signed-off-by: Miguel Cano <macanroj@gmail.com>
> Co-developed-by: David Gow <davidgow@google.com>
> Signed-off-by: David Gow <davidgow@google.com>
> Co-developed-by: Tiago Lam <tiagolam@gmail.com>
> Signed-off-by: Tiago Lam <tiagolam@gmail.com>
> Co-developed-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
> Signed-off-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
> Co-developed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> .gitignore | 6 +
> .rustfmt.toml | 12 +
> Makefile | 172 +++++++-
> arch/Kconfig | 6 +
> arch/arm/Kconfig | 1 +
> arch/arm64/Kconfig | 1 +
> arch/powerpc/Kconfig | 1 +
> arch/riscv/Kconfig | 1 +
> arch/riscv/Makefile | 5 +
> arch/um/Kconfig | 1 +
> arch/x86/Kconfig | 1 +
> arch/x86/Makefile | 10 +
> include/linux/compiler_types.h | 6 +-
> init/Kconfig | 46 +-
> lib/Kconfig.debug | 82 ++++
> rust/.gitignore | 10 +
> rust/Makefile | 415 +++++++++++++++++++
> rust/bindgen_parameters | 21 +
> scripts/.gitignore | 1 +
> scripts/Kconfig.include | 6 +-
> scripts/Makefile | 3 +
> scripts/Makefile.build | 60 +++
> scripts/Makefile.debug | 10 +
> scripts/Makefile.host | 34 +-
> scripts/Makefile.lib | 12 +
> scripts/Makefile.modfinal | 8 +-
> scripts/cc-version.sh | 12 +-
> scripts/generate_rust_target.rs | 232 +++++++++++
> scripts/is_rust_module.sh | 16 +
> scripts/kconfig/confdata.c | 75 ++++
> scripts/min-tool-version.sh | 6 +
> scripts/rust-is-available-bindgen-libclang.h | 2 +
> scripts/rust-is-available.sh | 160 +++++++
> 33 files changed, 1408 insertions(+), 26 deletions(-)
> create mode 100644 .rustfmt.toml
> create mode 100644 rust/.gitignore
> create mode 100644 rust/Makefile
> create mode 100644 rust/bindgen_parameters
> create mode 100644 scripts/generate_rust_target.rs
> create mode 100755 scripts/is_rust_module.sh
> create mode 100644 scripts/rust-is-available-bindgen-libclang.h
> create mode 100755 scripts/rust-is-available.sh
>






> @@ -151,7 +162,8 @@ config WERROR
> default COMPILE_TEST
> help
> A kernel build should not cause any compiler warnings, and this
> - enables the '-Werror' flag to enforce that rule by default.
> + enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags
> + to enforce that rule by default.
>
> However, if you have a new (or very old) compiler with odd and
> unusual warnings, or you have some architecture with problems,
> @@ -1898,6 +1910,38 @@ config PROFILING
> Say Y here to enable the extended profiling support mechanisms used
> by profilers.
>
> +config RUST
> + bool "Rust support"
> + depends on HAVE_RUST
> + depends on RUST_IS_AVAILABLE
> + depends on !MODVERSIONS
> + depends on !GCC_PLUGINS
> + depends on !RANDSTRUCT
> + depends on !DEBUG_INFO_BTF
> + select CONSTRUCTORS
> + help
> + Enables Rust support in the kernel.
> +
> + This allows other Rust-related options, like drivers written in Rust,
> + to be selected.
> +
> + It is also required to be able to load external kernel modules
> + written in Rust.
> +
> + See Documentation/rust/ for more information.
> +
> + If unsure, say N.
> +
> +config RUSTC_VERSION_TEXT
> + string
> + depends on RUST
> + default $(shell,command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version || echo n)
> +
> +config BINDGEN_VERSION_TEXT
> + string
> + depends on RUST
> + default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version || echo n)
> +



Where are these config options used?


I grep'ed but no hit.


masahiro@zoe:~/ref/linux-next$ git grep RUSTC_VERSION_TEXT
init/Kconfig:config RUSTC_VERSION_TEXT
masahiro@zoe:~/ref/linux-next$ git grep BINDGEN_VERSION_TEXT
init/Kconfig:config BINDGEN_VERSION_TEXT



> --
> 2.37.1
>


--
Best Regards
Masahiro Yamada

\
 
 \ /
  Last update: 2022-09-06 20:15    [W:0.268 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site