Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4712383rwb; Tue, 6 Sep 2022 11:25:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR5L+r4BM9X8JkpR24LMJh6O+lcl5p9Eh9xLFsoivh292u8mFwVo5MvwgEBvVNWo77cNctPm X-Received: by 2002:a17:906:8a53:b0:770:7aea:2350 with SMTP id gx19-20020a1709068a5300b007707aea2350mr317833ejc.17.1662488707647; Tue, 06 Sep 2022 11:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662488707; cv=none; d=google.com; s=arc-20160816; b=eSHKVVXPnV+4kSGMQgfi9xfD3eOxIBfQsdh6CLUMQthINGKRzJcHRkpcU7HTDGEXFg 0MZQUk5OEL3NQxpbkOqgkrh7u9KufDD8EFFo2hJ8kQXB5wxyBl+Bh8JuJX36qNr+UWfo +MqYPXCpwRmSxALUqIsZ12nrlI1Z+E0E/cyCWzRvPinISHEq1G5RJ3d80CxaPbzeK0HS fG5Luf5QT/YCUDIbWADcrWM4iMe4eyHxXRJVNL+Az0VkHnWlXHS503QZHtpXzApWBHWY GUu1+0GISqz0YLMs3Q/nGVtT6vA9bEihoP9vlH6pawOU0brVHRBFQ/QvZWovMiWbqaXg jlgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:dkim-filter; bh=XoFOHD9hbfQLitaVdmtOBiY1QAcAg6OYZ0EoW2xUSHA=; b=cTlNvgVmCiCnwkNhPjYxpFtXlqEyRtwBWwMZEtah7lIRJy/iEEaw6jPu7dpZI2tdon /Pwqbk9KC6d1HikvUoe5/7Law5Tqs29djfrGgXOlbXY/WJ9LPZpAGaiPSTf2nOIH46pi 4BCu/lU5U8vrTf9XTLQNY8Rg2kHYfGuTtAuMOobm7skh/Qx4kuMtRzjuPJ5TkBVuN+lK SgeoQSLX1XAHd0kBg1ryXGVWZrpXyG0sffwctv2sZXNR+9atYbtUde+h/3tou2bnhOJn PoLMvW/jBT6woaEu75opE6uJbAX8tVJxzjffOCo1TqWCdq0zOi28Miypsv6aAV81e+jm FPOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=WMwxm1JU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu9-20020a170907a08900b00730672860bdsi10121819ejc.123.2022.09.06.11.24.42; Tue, 06 Sep 2022 11:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=WMwxm1JU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbiIFSOn (ORCPT + 99 others); Tue, 6 Sep 2022 14:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiIFSOm (ORCPT ); Tue, 6 Sep 2022 14:14:42 -0400 X-Greylist: delayed 112 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 06 Sep 2022 11:14:39 PDT Received: from condef-05.nifty.com (condef-05.nifty.com [202.248.20.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 263EF10FFC; Tue, 6 Sep 2022 11:14:37 -0700 (PDT) Received: from conssluserg-02.nifty.com ([10.126.8.81])by condef-05.nifty.com with ESMTP id 286I9XYv018478; Wed, 7 Sep 2022 03:09:33 +0900 Received: from mail-oa1-f43.google.com (mail-oa1-f43.google.com [209.85.160.43]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 286I9DXU016423; Wed, 7 Sep 2022 03:09:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 286I9DXU016423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1662487754; bh=XoFOHD9hbfQLitaVdmtOBiY1QAcAg6OYZ0EoW2xUSHA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WMwxm1JUj1lG/kQzHh5Sz9awcHy9K1v98hp/4lyt1vUyP0UKVJCW4L0GauxmCQxbn GNRZj6DH3bzCtYVVklQW8MxvU8AHPdvvOrTwwEysvpcuV0laa0wlxtCnMgckbeeDnX bNcNpGZZp+cXOJ3I7ovTfX/P2NDLbtOxCFda980oiasxRY11+0tJveu5oXVDgyqudx niQ0wTph0WLrfqw8iFiDglpoD7EAJzPg+AigwdRA+KFtgauqP+n6xP/MNnd2MzQ5EJ j4v+GbYloXECi+hLObeNR3kxf00FKMiyspWsHOeKAtoW437H+tsxoUe0+d0IIwSVcY hi8kVGESaB8VA== X-Nifty-SrcIP: [209.85.160.43] Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-1279948d93dso10350444fac.10; Tue, 06 Sep 2022 11:09:13 -0700 (PDT) X-Gm-Message-State: ACgBeo0Ri2tsOAV4Wx2jcGjBYD+VK65Hcqhrka+srB5uAP6fLR95jIsZ SCitBHBQ3yhSLlgecEoslTRmETTGOsNrue7dP/E= X-Received: by 2002:a05:6870:f626:b0:10d:a798:f3aa with SMTP id ek38-20020a056870f62600b0010da798f3aamr12376388oab.194.1662487752576; Tue, 06 Sep 2022 11:09:12 -0700 (PDT) MIME-Version: 1.0 References: <20220802015052.10452-1-ojeda@kernel.org> <20220802015052.10452-28-ojeda@kernel.org> In-Reply-To: <20220802015052.10452-28-ojeda@kernel.org> From: Masahiro Yamada Date: Wed, 7 Sep 2022 03:08:36 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 27/31] Kbuild: add Rust support To: Miguel Ojeda Cc: Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, Linux Kernel Mailing List , Jarkko Sakkinen , Alex Gaynor , Finn Behrens , Adam Bratschi-Kaye , Wedson Almeida Filho , Michael Ellerman , Sven Van Asbroeck , Gary Guo , Boris-Chengbiao Zhou , Boqun Feng , Douglas Su , Dariusz Sosnowski , Antonio Terceiro , Daniel Xu , Miguel Cano , David Gow , Tiago Lam , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Martin Rodriguez Reboredo , Michal Marek , Nick Desaulniers , Russell King , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , Linux Kbuild mailing list , linux-arm-kernel , linuxppc-dev , "open list:SIFIVE DRIVERS" , linux-um@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 2, 2022 at 10:53 AM Miguel Ojeda 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 > Signed-off-by: Alex Gaynor > Co-developed-by: Finn Behrens > Signed-off-by: Finn Behrens > Co-developed-by: Adam Bratschi-Kaye > Signed-off-by: Adam Bratschi-Kaye > Co-developed-by: Wedson Almeida Filho > Signed-off-by: Wedson Almeida Filho > Co-developed-by: Michael Ellerman > Signed-off-by: Michael Ellerman > Co-developed-by: Sven Van Asbroeck > Signed-off-by: Sven Van Asbroeck > Co-developed-by: Gary Guo > Signed-off-by: Gary Guo > Co-developed-by: Boris-Chengbiao Zhou > Signed-off-by: Boris-Chengbiao Zhou > Co-developed-by: Boqun Feng > Signed-off-by: Boqun Feng > Co-developed-by: Douglas Su > Signed-off-by: Douglas Su > Co-developed-by: Dariusz Sosnowski > Signed-off-by: Dariusz Sosnowski > Co-developed-by: Antonio Terceiro > Signed-off-by: Antonio Terceiro > Co-developed-by: Daniel Xu > Signed-off-by: Daniel Xu > Co-developed-by: Miguel Cano > Signed-off-by: Miguel Cano > Co-developed-by: David Gow > Signed-off-by: David Gow > Co-developed-by: Tiago Lam > Signed-off-by: Tiago Lam > Co-developed-by: Bj=C3=B6rn Roy Baron > Signed-off-by: Bj=C3=B6rn Roy Baron > Co-developed-by: Martin Rodriguez Reboredo > Signed-off-by: Martin Rodriguez Reboredo > Signed-off-by: Miguel Ojeda > --- > .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 && $(BINDGE= N) --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