Re: [PATCH 2/4] kbuild: remove cc-option test of -fno-merge-all-constants

From: Nathan Chancellor
Date: Thu Sep 10 2020 - 12:44:17 EST


On Thu, Sep 10, 2020 at 10:51:18PM +0900, Masahiro Yamada wrote:
> The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.
>
> Here is the godbolt:
> https://godbolt.org/z/8T4177
>
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>

For what it's worth, the commit that introduced this block is going to
be reverted:

https://lore.kernel.org/mm-commits/20200903201518.JKrRS%25akpm@xxxxxxxxxxxxxxxxxxxx/

Regardless, it was introduced in LLVM 2.7.0 in commit
f9d41df0930986c52e198292cf875eb5d1761ece.

Reviewed-by: Nathan Chancellor <natechancellor@xxxxxxxxx>

> ---
>
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 059b36f2ea53..1b6abecc5cab 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -927,7 +927,7 @@ KBUILD_CFLAGS += -fno-strict-overflow
> # clang sets -fmerge-all-constants by default as optimization, but this
> # is non-conforming behavior for C and in fact breaks the kernel, so we
> # need to disable it here generally.
> -KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
> +KBUILD_CFLAGS += -fno-merge-all-constants
>
> # for gcc -fno-merge-all-constants disables everything, but it is fine
> # to have actual conforming behavior enabled.
> --
> 2.25.1
>