@@ -669,18 +669,18 @@ more details, with real examples.
gcc-min-version
gcc-min-version tests if the value of $(CONFIG_GCC_VERSION) is greater than
- or equal to the provided value and evaluates to y if so.
+ or equal to the provided value (in 6-digit form) and evaluates to y if so.
Example::
- cflags-$(call gcc-min-version, 70100) := -foo
+ cflags-$(call gcc-min-version, 070100) := -foo
In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and
$(CONFIG_GCC_VERSION) is >= 7.1.
clang-min-version
clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater
- than or equal to the provided value and evaluates to y if so.
+ than or equal to the provided value (in 6-digit form) and evaluates to y if so.
Example::
@@ -1050,7 +1050,7 @@ endif
# ignored, continuing to default to PTRDIFF_MAX. So, left with no other
# choice, we must perform a versioned check to disable this warning.
# https://lore.kernel.org/lkml/20210824115859.187f272f@canb.auug.org.au
-KBUILD_CFLAGS-$(call gcc-min-version, 90100) += -Wno-alloc-size-larger-than
+KBUILD_CFLAGS-$(call gcc-min-version, 090100) += -Wno-alloc-size-larger-than
KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
# disable invalid "can't wrap" optimizations for signed / pointers
@@ -34,7 +34,7 @@ dml_ccflags := -mhard-float -maltivec
endif
ifdef CONFIG_CC_IS_GCC
-ifneq ($(call gcc-min-version, 70100),y)
+ifneq ($(call gcc-min-version, 070100),y)
IS_OLD_GCC = 1
endif
endif
@@ -62,12 +62,12 @@ cc-disable-warning = $(call try-run,\
$(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# gcc-min-version
-# Usage: cflags-$(call gcc-min-version, 70100) += -foo
-gcc-min-version = $(shell [ $(CONFIG_GCC_VERSION)0 -ge $(1)0 ] && echo y)
+# Usage: cflags-$(call gcc-min-version, 070100) += -foo
+gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1)
# clang-min-version
# Usage: cflags-$(call clang-min-version, 110000) += -foo
-clang-min-version = $(shell [ $(CONFIG_CLANG_VERSION)0 -ge $(1)0 ] && echo y)
+clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1)
# ld-option
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
Now CONFIG_{GCC,CLANG}_VERSION are always 6-digit, replace the shell invocations with the test-ge macro. Please note gcc-min-version must be used against a 6-digit number. Add '0' prefix. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- Documentation/kbuild/makefiles.rst | 6 +++--- Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +- scripts/Makefile.compiler | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-)