From e83c037c23e6076892b9a0a2c64c2cd77d01f5c3 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Wed, 30 Mar 2022 16:45:27 -0700 Subject: [PATCH] kbuild: Remove '-mno-global-merge' This flag is specific to clang, where it is only used by the 32-bit and 64-bit ARM backends. In certain situations, the presence of this flag will cause a warning, as shown by commit 6580c5c18fb3 ("um: clang: Strip out -mno-global-merge from USER_CFLAGS"). Since commit 61163efae020 ("kbuild: LLVMLinux: Add Kbuild support for building kernel with Clang") that added this flag back in 2014, there have been quite a few changes to the GlobalMerge pass in LLVM. Building several different ARCH=arm and ARCH=arm64 configurations with LLVM 11 (minimum) and 15 (current main version) with this flag removed (i.e., with the default of '-mglobal-merge') reveals no modpost warnings, so it is likely that the issue noted in the comment is no longer relevant due to changes in LLVM or modpost, meaning this flag can be removed. If any new warnings show up that are a result of the removal of this flag, it can be added back under arch/arm{,64}/Makefile to avoid warnings on other architectures. Signed-off-by: Nathan Chancellor Tested-by: David Gow Reviewed-by: Kees Cook Tested-by: Sedat Dilek Reviewed-by: Sedat Dilek Signed-off-by: Masahiro Yamada Change-Id: Ice39a960619319828b83c8091798fe383395a2b0 Signed-off-by: Alexander Winkowski --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index ca64f96bd193..ac4169832c64 100644 --- a/Makefile +++ b/Makefile @@ -797,10 +797,6 @@ KBUILD_CFLAGS += -Wno-format-invalid-specifier KBUILD_CFLAGS += -Wno-gnu # Quiet clang warning: comparison of unsigned expression < 0 is always false KBUILD_CFLAGS += -Wno-tautological-compare -# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the -# source of a reference will be _MergedGlobals and not on of the whitelisted names. -# See modpost pattern 2 -KBUILD_CFLAGS += -mno-global-merge KBUILD_CFLAGS += $(call cc-disable-warning, undefined-optimized) else