linux/init
Miguel Ojeda 6e74c6b5a4 kbuild: rust: add CONFIG_RUSTC_VERSION
Now that we support several Rust versions, introduce
`CONFIG_RUSTC_VERSION` so that it can be used in Kconfig to enable and
disable configuration options based on the `rustc` version.

The approach taken resembles `pahole`'s -- see commit 613fe16923
("kbuild: Add CONFIG_PAHOLE_VERSION"), i.e. a simple version parsing
without trying to identify several kinds of compilers, since so far
there is only one (`rustc`).

However, unlike `pahole`'s, we also print a zero if executing failed for
any reason, rather than checking if the command is found and executable
(which still leaves things like a file that exists and is executable,
but e.g. is built for another platform [1]). An equivalent approach to
the one here was also submitted for `pahole` [2].

Link: https://lore.kernel.org/rust-for-linux/CANiq72=4vX_tJMJLE6e+bg7ZECHkS-AQpm8GBzuK75G1EB7+Nw@mail.gmail.com/ [1]
Link: https://lore.kernel.org/linux-kbuild/20240728125527.690726-1-ojeda@kernel.org/ [2]
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Tested-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20240902165535.1101978-2-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-09-05 22:44:18 +02:00
..
.gitignore kbuild: build init/built-in.a just once 2022-09-29 04:40:15 +09:00
calibrate.c
do_mounts_initrd.c initrd: remove the now superfluous sentinel element from ctl_table array 2024-04-25 21:07:05 -07:00
do_mounts_rd.c
do_mounts.c init: replace deprecated strncpy with strscpy_pad 2024-04-30 10:34:29 -07:00
do_mounts.h init: flush async file closing 2024-02-08 18:41:03 +01:00
init_task.c Livepatching changes for 6.10 2024-05-15 13:07:49 -07:00
initramfs.c Merge 6.9-rc5 into driver-core-next 2024-04-23 13:27:43 +02:00
Kconfig kbuild: rust: add CONFIG_RUSTC_VERSION 2024-09-05 22:44:18 +02:00
main.c Mainly singleton patches, documented in their respective changelogs. 2024-05-19 14:02:03 -07:00
Makefile kbuild: move init/build-version to scripts/ 2024-07-16 01:08:37 +09:00
noinitramfs.c init: move usermodehelper_enable() to populate_rootfs() 2021-09-08 11:50:27 -07:00
version-timestamp.c init/version-timestamp.c: remove unneeded #include <linux/version.h> 2023-01-09 07:34:38 +09:00
version.c init/version.c: Replace strlcpy with strscpy 2023-09-22 09:50:56 -07:00