[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y36Ef3ie05YO1moS@bergen.fjasle.eu>
Date: Wed, 23 Nov 2022 21:37:19 +0100
From: Nicolas Schier <nicolas@...sle.eu>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, llvm@...ts.linux.dev
Subject: Re: [PATCH v2 2/5] kbuild: implement {gcc,clang}-min-version only
with built-in functions
On Thu 24 Nov 2022 00:18:25 GMT, Masahiro Yamada wrote:
> Converting clang-min-version is straightforward because the versions
> are always 6-digit.
>
> gcc-min-version is somewhat tricky because the minimal GCC version
> is GCC 5.2; prepend '0' to the version that is less than 10 so that
> test-ge is always passed with 6-digit versions.
>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---
>
> Changes in v2:
> - Covert gcc-min-version in a different way
>
> scripts/Makefile.compiler | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
> index 20d353dcabfb..cd75f81e88ef 100644
> --- a/scripts/Makefile.compiler
> +++ b/scripts/Makefile.compiler
> @@ -63,11 +63,15 @@ cc-disable-warning = $(call try-run,\
>
> # gcc-min-version
> # Usage: cflags-$(call gcc-min-version, 70100) += -foo
> -gcc-min-version = $(shell [ $(CONFIG_GCC_VERSION)0 -ge $(1)0 ] && echo y)
> +
> +# Preprend 0 to the version that is less than 10 so test-ge works.
> +gcc-min-version = $(call test-ge, \
> + $(or $(filter 1%, $(CONFIG_GCC_VERSION)), 0$(CONFIG_GCC_VERSION)), \
> + $(or $(filter 1%, $1), 0$(strip $1)))
Hm, this silently expects a gcc version < 20, which we should expect in
about seven-eight years [1]. I am thinking about the possibility of
silent (but unlikely) breaks when someone in far future uses a gcc 20
against a kernel with this line. Probably we should not care about
that today, yet, right?
Reviewed-by: Nicolas Schier <nicolas@...sle.eu>
[1]: https://gcc.gnu.org/develop.html#timeline
>
> # 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
--
epost|xmpp: nicolas@...sle.eu irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
-- frykten for herren er opphav til kunnskap --
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists