[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221118195307.86049-4-masahiroy@kernel.org>
Date: Sat, 19 Nov 2022 04:53:04 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Masahiro Yamada <masahiroy@...nel.org>
Subject: [PATCH 3/6] kbuild: implement {gcc,clang}-min-version only with built-in functions
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@...nel.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(-)
diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index 6b7368d1f516..4144f1ce1ab5 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -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::
diff --git a/Makefile b/Makefile
index 303516c035f6..03e6ae36c815 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
index ca7d24000621..8006801d1b56 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@ -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
diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
index 20d353dcabfb..db6f0546b0fc 100644
--- a/scripts/Makefile.compiler
+++ b/scripts/Makefile.compiler
@@ -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)
--
2.34.1
Powered by blists - more mailing lists