From 94449760ca66ba1677b1a28b4ed5a1a743427929 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Fri, 29 Jan 2021 20:09:09 +0100 Subject: [PATCH] Revert "kbuild: disable clang's default use of -fmerge-all-constants" This reverts commit 87e0d4f. -fno-merge-all-constants has been the default since clang-6; the minimum supported version of clang in the kernel is clang-10 (10.0.1). Suggested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers Signed-off-by: Andrew Morton Tested-by: Sedat Dilek Reviewed-by: Fangrui Song Reviewed-by: Nathan Chancellor Reviewed-by: Sedat Dilek Reviewed-by: Kees Cook Cc: Andrey Konovalov Cc: Marco Elver Cc: Miguel Ojeda Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Masahiro Yamada Cc: Vincenzo Frascino Cc: Will Deacon Link: https://lkml.kernel.org/r/20200902225911.209899-3-ndesaulniers@google.com Link: https://reviews.llvm.org/rL329300. Link: #9 Signed-off-by: Linus Torvalds --- Makefile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Makefile b/Makefile index 33c41dbc35f3..e1c0dcfc88fa 100644 --- a/Makefile +++ b/Makefile @@ -978,15 +978,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-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) - -# for gcc -fno-merge-all-constants disables everything, but it is fine -# to have actual conforming behavior enabled. -KBUILD_CFLAGS += $(call cc-option,-fmerge-constants) - # Make sure -fstack-check isn't enabled (like gentoo apparently did) KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)