From: Shreeya Patel <shreeya.patel@collabora.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Michal Marek <michal.lkml@markovi.net>,
Masahiro Yamada <masahiroy@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
clang-built-linux <llvm@lists.linux.dev>,
Bill Wendling <morbo@google.com>,
Nathan Chancellor <nathan@kernel.org>,
regressions@lists.linux.dev
Subject: Re: [PATCH v4] Makefile.compiler: replace cc-ifversion with compiler-specific macros
Date: Thu, 27 Apr 2023 17:23:58 +0530 [thread overview]
Message-ID: <597ef55f-e7c1-ab60-b4aa-0071ff4b5e0e@collabora.com> (raw)
In-Reply-To: <20220919170828.3718437-1-ndesaulniers@google.com>
Hi Nick,
On 19/09/22 22:38, Nick Desaulniers wrote:
> cc-ifversion is GCC specific. Replace it with compiler specific
> variants. Update the users of cc-ifversion to use these new macros.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/350
> Link: https://lore.kernel.org/llvm/CAGG=3QWSAUakO42kubrCap8fp-gm1ERJJAYXTnP1iHk_wrH=BQ@mail.gmail.com/
> Suggested-by: Bill Wendling <morbo@google.com>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
KernelCI found this patch causes a regression in the
baseline.logintest on qemu_arm-virt-gicv3-uefi [1],
see the bisection report for more details [2].
Let me know if you have any questions.
[1] https://linux.kernelci.org/test/case/id/644596a0beca2ead032e8669/
[2] https://groups.io/g/kernelci-results/message/40804
Thanks,
Shreeya Patel
#regzbot introduced: 88b61e3bff93
> ---
> Changes v3 -> v4:
> * Split into its own patch again from series, as per Masahiro.
> * Rebase on top of b0839b281c427e844143dba3893e25c83cdd6c17 and update
> clang -Wformat logic in scripts/Makefile.extrawarn, as per Masahiro.
>
> Documentation/kbuild/makefiles.rst | 29 ++++++++++++---------
> Makefile | 6 ++---
> drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +-
> scripts/Makefile.compiler | 10 ++++---
> scripts/Makefile.extrawarn | 4 +--
> 5 files changed, 29 insertions(+), 22 deletions(-)
>
> diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
> index 11a296e52d68..ee7e3ea1fbe1 100644
> --- a/Documentation/kbuild/makefiles.rst
> +++ b/Documentation/kbuild/makefiles.rst
> @@ -682,22 +682,27 @@ more details, with real examples.
> In the above example, -Wno-unused-but-set-variable will be added to
> KBUILD_CFLAGS only if gcc really accepts it.
>
> - cc-ifversion
> - cc-ifversion tests the version of $(CC) and equals the fourth parameter
> - if version expression is true, or the fifth (if given) if the version
> - expression is false.
> + 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.
>
> Example::
>
> - #fs/reiserfs/Makefile
> - ccflags-y := $(call cc-ifversion, -lt, 0402, -O1)
> + cflags-$(call gcc-min-version, 70100) := -foo
>
> - In this example, ccflags-y will be assigned the value -O1 if the
> - $(CC) version is less than 4.2.
> - cc-ifversion takes all the shell operators:
> - -eq, -ne, -lt, -le, -gt, and -ge
> - The third parameter may be a text as in this example, but it may also
> - be an expanded variable or a macro.
> + 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.
> +
> + Example::
> +
> + cflags-$(call clang-min-version, 110000) := -foo
> +
> + In this example, cflags-y will be assigned the value -foo if $(CC) is clang
> + and $(CONFIG_CLANG_VERSION) is >= 11.0.0.
>
> cc-cross-prefix
> cc-cross-prefix is used to check if there exists a $(CC) in path with
> diff --git a/Makefile b/Makefile
> index 298f69060f10..411c8480b37e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -790,7 +790,6 @@ KBUILD_CFLAGS += $(stackp-flags-y)
>
> KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
> KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
> -KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
>
> ifdef CONFIG_CC_IS_CLANG
> KBUILD_CPPFLAGS += -Qunused-arguments
> @@ -972,7 +971,6 @@ ifdef CONFIG_CC_IS_GCC
> KBUILD_CFLAGS += -Wno-maybe-uninitialized
> endif
>
> -ifdef CONFIG_CC_IS_GCC
> # The allocators already balk at large sizes, so silence the compiler
> # warnings for bounds checks involving those possible values. While
> # -Wno-alloc-size-larger-than would normally be used here, earlier versions
> @@ -984,8 +982,8 @@ ifdef CONFIG_CC_IS_GCC
> # 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 cc-ifversion, -ge, 0901, -Wno-alloc-size-larger-than)
> -endif
> +KBUILD_CFLAGS-$(call gcc-min-version, 90100) += -Wno-alloc-size-larger-than
> +KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
>
> # disable invalid "can't wrap" optimizations for signed / pointers
> KBUILD_CFLAGS += -fno-strict-overflow
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index cb81ed2fbd53..d70838edba80 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
> -ifeq ($(call cc-ifversion, -lt, 0701, y), y)
> +ifneq ($(call gcc-min-version, 70100),y)
> IS_OLD_GCC = 1
> endif
> endif
> diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler
> index 94d0d40cddb3..9d18fb91890e 100644
> --- a/scripts/Makefile.compiler
> +++ b/scripts/Makefile.compiler
> @@ -61,9 +61,13 @@ cc-option-yn = $(call try-run,\
> 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)))
>
> -# cc-ifversion
> -# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
> -cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
> +# gcc-min-version
> +# Usage: cflags-$(call gcc-min-version, 70100) += -foo
> +gcc-min-version = $(shell [ $(CONFIG_GCC_VERSION) -ge $(1) ] && echo y)
> +
> +# clang-min-version
> +# Usage: cflags-$(call clang-min-version, 110000) += -foo
> +clang-min-version = $(shell [ $(CONFIG_CLANG_VERSION) -ge $(1) ] && echo y)
>
> # ld-option
> # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 6ae482158bc4..5769c1939d40 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -48,7 +48,7 @@ else
> ifdef CONFIG_CC_IS_CLANG
> KBUILD_CFLAGS += -Wno-initializer-overrides
> # Clang before clang-16 would warn on default argument promotions.
> -ifeq ($(shell [ $(CONFIG_CLANG_VERSION) -lt 160000 ] && echo y),y)
> +ifneq ($(call clang-min-version, 160000),y)
> # Disable -Wformat
> KBUILD_CFLAGS += -Wno-format
> # Then re-enable flags that were part of the -Wformat group that aren't
> @@ -56,7 +56,7 @@ KBUILD_CFLAGS += -Wno-format
> KBUILD_CFLAGS += -Wformat-extra-args -Wformat-invalid-specifier
> KBUILD_CFLAGS += -Wformat-zero-length -Wnonnull
> # Requires clang-12+.
> -ifeq ($(shell [ $(CONFIG_CLANG_VERSION) -ge 120000 ] && echo y),y)
> +ifeq ($(call clang-min-version, 120000),y)
> KBUILD_CFLAGS += -Wformat-insufficient-args
> endif
> endif
next prev parent reply other threads:[~2023-04-27 11:54 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 4:59 [PATCH v3 0/5] fix debug info for asm and DEBUG_INFO_SPLIT Nick Desaulniers
2022-09-07 4:59 ` [PATCH v3 1/5] x86/boot/compressed: prefer cc-option for CFLAGS additions Nick Desaulniers
2022-09-09 21:05 ` Masahiro Yamada
2022-09-07 4:59 ` [PATCH v3 2/5] Makefile.compiler: Use KBUILD_AFLAGS for as-option Nick Desaulniers
2022-09-09 21:06 ` Masahiro Yamada
2022-09-07 4:59 ` [PATCH v3 3/5] Makefile.compiler: replace cc-ifversion with compiler-specific macros Nick Desaulniers
2022-09-09 21:59 ` Masahiro Yamada
2022-09-07 4:59 ` [PATCH v3 4/5] Makefile.debug: re-enable debug info for .S files Nick Desaulniers
2022-09-07 4:59 ` [PATCH v3 5/5] Makefile.debug: set -g unconditional on CONFIG_DEBUG_INFO_SPLIT Nick Desaulniers
2022-09-09 20:56 ` Masahiro Yamada
2022-09-09 21:02 ` Masahiro Yamada
2022-09-19 17:08 ` [PATCH v4] Makefile.compiler: replace cc-ifversion with compiler-specific macros Nick Desaulniers
2022-09-23 19:44 ` Masahiro Yamada
2022-09-24 14:28 ` Masahiro Yamada
2022-09-25 1:22 ` Masahiro Yamada
2022-09-26 21:41 ` Nick Desaulniers
2023-04-27 11:53 ` Shreeya Patel [this message]
2023-04-28 7:41 ` Thorsten Leemhuis
2023-05-02 9:48 ` Shreeya Patel
2023-05-02 11:58 ` Linux regression tracking (Thorsten Leemhuis)
2023-04-28 17:27 ` Nick Desaulniers
2023-05-03 21:02 ` Shreeya Patel
2023-05-03 21:15 ` Nick Desaulniers
2023-05-03 22:33 ` Shreeya Patel
2023-05-15 23:01 ` Nick Desaulniers
2023-05-17 8:34 ` Shreeya Patel
2023-05-17 15:39 ` Ricardo Cañuelo
2023-05-17 16:27 ` Nick Desaulniers
2023-05-18 14:23 ` Ricardo Cañuelo
2023-05-18 21:12 ` Nick Desaulniers
2023-05-19 8:35 ` Ricardo Cañuelo
2023-05-19 15:57 ` Nick Desaulniers
2023-05-22 10:09 ` Ricardo Cañuelo
2023-05-22 16:52 ` Greg KH
2023-05-22 19:52 ` Nick Desaulniers
2023-05-22 20:01 ` Greg KH
2023-05-22 20:16 ` Nick Desaulniers
2023-05-23 10:27 ` Shreeya Patel
2023-05-23 21:27 ` Nick Desaulniers
2023-06-12 10:10 ` Shreeya Patel
2023-06-20 4:19 ` Masahiro Yamada
2023-07-10 12:09 ` Linux regression tracking (Thorsten Leemhuis)
2023-07-11 11:16 ` Shreeya Patel
2023-08-29 11:28 ` Linux regression tracking (Thorsten Leemhuis)
2023-09-11 10:05 ` Thorsten Leemhuis
2023-09-15 9:33 ` Shreeya Patel
2023-09-30 10:24 ` Masahiro Yamada
2022-09-19 17:30 ` [PATCH v4] Makefile.debug: set -g unconditional on CONFIG_DEBUG_INFO_SPLIT Nick Desaulniers
2022-09-24 1:34 ` Masahiro Yamada
2022-09-19 17:45 ` [PATCH v4] Makefile.debug: re-enable debug info for .S files Nick Desaulniers
2022-09-24 2:11 ` Masahiro Yamada
2022-09-24 2:20 ` Nick Desaulniers
2022-09-24 6:43 ` 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=597ef55f-e7c1-ab60-b4aa-0071ff4b5e0e@collabora.com \
--to=shreeya.patel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=regressions@lists.linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).