public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Schier <nicolas@fjasle.eu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>,
	llvm@lists.linux.dev
Subject: Re: [PATCH v2 2/5] kbuild: implement {gcc,clang}-min-version only with built-in functions
Date: Wed, 23 Nov 2022 21:37:19 +0100	[thread overview]
Message-ID: <Y36Ef3ie05YO1moS@bergen.fjasle.eu> (raw)
In-Reply-To: <20221123151828.509565-2-masahiroy@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]

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@kernel.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@fjasle.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@fjasle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-11-23 20:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 15:18 [PATCH v2 1/5] kbuild: add test-{le,ge,lt,gt} macros Masahiro Yamada
2022-11-23 15:18 ` [PATCH v2 2/5] kbuild: implement {gcc,clang}-min-version only with built-in functions Masahiro Yamada
2022-11-23 20:37   ` Nicolas Schier [this message]
2022-11-23 21:17     ` Masahiro Yamada
2022-11-23 15:18 ` [PATCH v2 3/5] kbuild: add read-file macro Masahiro Yamada
2022-11-23 21:01   ` Nicolas Schier
2022-11-23 21:52     ` Masahiro Yamada
2022-11-24  4:45       ` Nicolas Schier
2022-11-23 15:18 ` [PATCH v2 4/5] kconfig: refactor Makefile to reduce process forks Masahiro Yamada
2022-11-23 21:14   ` Nicolas Schier
2022-11-23 15:18 ` [PATCH v2 5/5] kbuild: check Make version Masahiro Yamada
2022-11-23 21:19   ` Nicolas Schier
2022-11-24  7:08     ` Nicolas Schier
2022-11-23 20:05 ` [PATCH v2 1/5] kbuild: add test-{le,ge,lt,gt} macros Nicolas Schier
2022-12-02 17:56 ` Palmer Dabbelt
2022-12-08  1:42 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y36Ef3ie05YO1moS@bergen.fjasle.eu \
    --to=nicolas@fjasle.eu \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox