Skip to content

Commit cf300b8

Browse files
nathanchancemasahir0y
authored andcommitted
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 6580c5c ("um: clang: Strip out -mno-global-merge from USER_CFLAGS"). Since commit 61163ef ("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 <nathan@kernel.org> Tested-by: David Gow <davidgow@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 099c22b commit cf300b8

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -793,10 +793,6 @@ ifdef CONFIG_CC_IS_CLANG
793793
KBUILD_CPPFLAGS += -Qunused-arguments
794794
# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
795795
KBUILD_CFLAGS += -Wno-gnu
796-
# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
797-
# source of a reference will be _MergedGlobals and not on of the whitelisted names.
798-
# See modpost pattern 2
799-
KBUILD_CFLAGS += -mno-global-merge
800796
else
801797

802798
# gcc inanely warns about local variables called 'main'

0 commit comments

Comments
 (0)