Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: rust: add rustc-min-version support function

Introduce `rustc-min-version` support function that mimics
`{gcc,clang}-min-version` ones, following commit 88b61e3bff93
("Makefile.compiler: replace cc-ifversion with compiler-specific macros").

In addition, use it in the first use case we have in the kernel (which
was done independently to minimize the changes needed for the fix).

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Fiona Behrens <me@Kloenk.dev>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Miguel Ojeda and committed by
Masahiro Yamada
ac954145 144fced6

+19 -1
+14
Documentation/kbuild/makefiles.rst
··· 667 667 endif 668 668 endif 669 669 670 + $(RUSTC) support functions 671 + -------------------------- 672 + 673 + rustc-min-version 674 + rustc-min-version tests if the value of $(CONFIG_RUSTC_VERSION) is greater 675 + than or equal to the provided value and evaluates to y if so. 676 + 677 + Example:: 678 + 679 + rustflags-$(call rustc-min-version, 108500) := -Cfoo 680 + 681 + In this example, rustflags-y will be assigned the value -Cfoo if 682 + $(CONFIG_RUSTC_VERSION) is >= 1.85.0. 683 + 670 684 $(LD) support functions 671 685 ----------------------- 672 686
+1 -1
arch/arm64/Makefile
··· 48 48 KBUILD_CFLAGS += $(call cc-disable-warning, psabi) 49 49 KBUILD_AFLAGS += $(compat_vdso) 50 50 51 - ifeq ($(call test-ge, $(CONFIG_RUSTC_VERSION), 108500),y) 51 + ifeq ($(call rustc-min-version, 108500),y) 52 52 KBUILD_RUSTFLAGS += --target=aarch64-unknown-none-softfloat 53 53 else 54 54 KBUILD_RUSTFLAGS += --target=aarch64-unknown-none -Ctarget-feature="-neon"
+4
scripts/Makefile.compiler
··· 67 67 # Usage: cflags-$(call clang-min-version, 110000) += -foo 68 68 clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1) 69 69 70 + # rustc-min-version 71 + # Usage: rustc-$(call rustc-min-version, 108500) += -Cfoo 72 + rustc-min-version = $(call test-ge, $(CONFIG_RUSTC_VERSION), $1) 73 + 70 74 # ld-option 71 75 # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y) 72 76 ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))