linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS
@ 2022-03-30 23:45 Nathan Chancellor
  2022-03-30 23:45 ` [PATCH 1/2] kbuild: Remove '-mno-global-merge' Nathan Chancellor
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-30 23:45 UTC (permalink / raw)
  To: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook
  Cc: linux-kbuild, linux-kernel, linux-um, llvm, patches, Nathan Chancellor

As discussed at [1] and [2], this series removes '-mno-global-merge'
from KBUILD_CFLAGS for clang, as it causes warnings for UML, and it
no longer appears to be necessary, as I do not see any modpost warnings
with LLVM 11 through 15 with several different ARCH=arm and ARCH=arm64
configurations.

[1] is currently in the UML tree, destined for 5.18, but it is buggy, as
I note in [2]. This series is an alternative to [2], which has not been
picked up yet, so it is based on the current UML tree. If [2] is picked
up, I can rework the first patch to remove the '-mno-global-merge'
filtering from arch/um/Makefile; otherwise, this should be picked up in
place of [2].

I intentionally kept the first patch vague around what fixed the modpost
warnings, as I am not too sure. [3] seems somewhat likely, but I don't
think that will revert cleanly on main to test. I think the testing is
enough to show that the original issue is resolved but I do note that we
can add this flag back in the architecture specific Makefiles if needed.

Please review and ack as necessary.

[1]: https://lore.kernel.org/r/20220303090643.241747-1-davidgow@google.com/
[2]: https://lore.kernel.org/r/20220322173547.677760-1-nathan@kernel.org/
[3]: https://github.com/llvm/llvm-project/commit/863bfdbfb446adaef767ff514d1f2ffb5d489562

Nathan Chancellor (2):
  kbuild: Remove '-mno-global-merge'
  Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS"

 Makefile         | 4 ----
 arch/um/Makefile | 4 ----
 2 files changed, 8 deletions(-)


base-commit: 82017457957a550d7d00dde419435dd74a890887
-- 
2.35.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] kbuild: Remove '-mno-global-merge'
  2022-03-30 23:45 [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS Nathan Chancellor
@ 2022-03-30 23:45 ` Nathan Chancellor
  2022-03-31  1:59   ` David Gow
                     ` (2 more replies)
  2022-03-30 23:45 ` [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS" Nathan Chancellor
  2022-04-01 13:03 ` [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS Masahiro Yamada
  2 siblings, 3 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-30 23:45 UTC (permalink / raw)
  To: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook
  Cc: linux-kbuild, linux-kernel, linux-um, llvm, patches, Nathan Chancellor

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 <nathan@kernel.org>
---
 Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/Makefile b/Makefile
index daeb5c88b50b..f2723d9bfca4 100644
--- a/Makefile
+++ b/Makefile
@@ -784,10 +784,6 @@ ifdef CONFIG_CC_IS_CLANG
 KBUILD_CPPFLAGS += -Qunused-arguments
 # The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
 KBUILD_CFLAGS += -Wno-gnu
-# 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
 else
 
 # gcc inanely warns about local variables called 'main'
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS"
  2022-03-30 23:45 [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS Nathan Chancellor
  2022-03-30 23:45 ` [PATCH 1/2] kbuild: Remove '-mno-global-merge' Nathan Chancellor
@ 2022-03-30 23:45 ` Nathan Chancellor
  2022-03-31  2:00   ` David Gow
  2022-03-31  4:58   ` Kees Cook
  2022-04-01 13:03 ` [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS Masahiro Yamada
  2 siblings, 2 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-30 23:45 UTC (permalink / raw)
  To: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook
  Cc: linux-kbuild, linux-kernel, linux-um, llvm, patches, Nathan Chancellor

This reverts commit 6580c5c18fb3df2b11c5e0452372f815deeff895.

This patch is buggy, as noted in the patch linked below. The root cause
has been solved by removing '-mno-global-merge' for the entire kernel.

Link: https://lore.kernel.org/r/20220322173547.677760-1-nathan@kernel.org/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/um/Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 320b09cd513c..f2fe63bfd819 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -75,10 +75,6 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
 		-D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \
 		-idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__
 
-ifdef CONFIG_CC_IS_CLANG
-USER_CFLAGS := $(patsubst -mno-global-merge,,$(USER_CFLAGS))
-endif
-
 #This will adjust *FLAGS accordingly to the platform.
 include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] kbuild: Remove '-mno-global-merge'
  2022-03-30 23:45 ` [PATCH 1/2] kbuild: Remove '-mno-global-merge' Nathan Chancellor
@ 2022-03-31  1:59   ` David Gow
  2022-03-31  4:57   ` Kees Cook
  2022-03-31  7:11   ` Sedat Dilek
  2 siblings, 0 replies; 11+ messages in thread
From: David Gow @ 2022-03-31  1:59 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook, linux-kbuild,
	Linux Kernel Mailing List, linux-um, llvm, patches

On Thu, Mar 31, 2022 at 7:46 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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 <nathan@kernel.org>
> ---

This seems to work fine here under the KUnit tooling, with both x86_64
and arm64. That admittedly doesn't do anything with modules, so
wouldn't reveal any of those issues, but at least the warnings about
--mno-global-merge existing remain gone.

Tested-by: David Gow <davidgow@google.com>

Cheers,
-- David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS"
  2022-03-30 23:45 ` [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS" Nathan Chancellor
@ 2022-03-31  2:00   ` David Gow
  2022-03-31  4:58   ` Kees Cook
  1 sibling, 0 replies; 11+ messages in thread
From: David Gow @ 2022-03-31  2:00 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook, linux-kbuild,
	Linux Kernel Mailing List, linux-um, llvm, patches

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

On Thu, Mar 31, 2022 at 7:46 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> This reverts commit 6580c5c18fb3df2b11c5e0452372f815deeff895.
>
> This patch is buggy, as noted in the patch linked below. The root cause
> has been solved by removing '-mno-global-merge' for the entire kernel.
>
> Link: https://lore.kernel.org/r/20220322173547.677760-1-nathan@kernel.org/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---

Looks good to me: getting rid of -mno-global-merge entirely is nicer, anyway.

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] kbuild: Remove '-mno-global-merge'
  2022-03-30 23:45 ` [PATCH 1/2] kbuild: Remove '-mno-global-merge' Nathan Chancellor
  2022-03-31  1:59   ` David Gow
@ 2022-03-31  4:57   ` Kees Cook
  2022-03-31  7:11   ` Sedat Dilek
  2 siblings, 0 replies; 11+ messages in thread
From: Kees Cook @ 2022-03-31  4:57 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, linux-kbuild, linux-kernel,
	linux-um, llvm, patches

On Wed, Mar 30, 2022 at 04:45:27PM -0700, Nathan Chancellor wrote:
> 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 <nathan@kernel.org>

Yeah, this looks right -- the history of this option seems to show it
is no longer needed.

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS"
  2022-03-30 23:45 ` [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS" Nathan Chancellor
  2022-03-31  2:00   ` David Gow
@ 2022-03-31  4:58   ` Kees Cook
  1 sibling, 0 replies; 11+ messages in thread
From: Kees Cook @ 2022-03-31  4:58 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, linux-kbuild, linux-kernel,
	linux-um, llvm, patches

On Wed, Mar 30, 2022 at 04:45:28PM -0700, Nathan Chancellor wrote:
> This reverts commit 6580c5c18fb3df2b11c5e0452372f815deeff895.
> 
> This patch is buggy, as noted in the patch linked below. The root cause
> has been solved by removing '-mno-global-merge' for the entire kernel.
> 
> Link: https://lore.kernel.org/r/20220322173547.677760-1-nathan@kernel.org/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] kbuild: Remove '-mno-global-merge'
  2022-03-30 23:45 ` [PATCH 1/2] kbuild: Remove '-mno-global-merge' Nathan Chancellor
  2022-03-31  1:59   ` David Gow
  2022-03-31  4:57   ` Kees Cook
@ 2022-03-31  7:11   ` Sedat Dilek
  2022-03-31 15:37     ` Nathan Chancellor
  2 siblings, 1 reply; 11+ messages in thread
From: Sedat Dilek @ 2022-03-31  7:11 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook, linux-kbuild,
	linux-kernel, linux-um, llvm, patches

On Thu, Mar 31, 2022 at 5:27 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> 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 <nathan@kernel.org>
> ---
>  Makefile | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index daeb5c88b50b..f2723d9bfca4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -784,10 +784,6 @@ ifdef CONFIG_CC_IS_CLANG
>  KBUILD_CPPFLAGS += -Qunused-arguments
>  # The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
>  KBUILD_CFLAGS += -Wno-gnu
> -# 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
>  else
>
>  # gcc inanely warns about local variables called 'main'
> --
> 2.35.1
>

I have tested this several times and was able to boot into bar metal -
no problems with building and/or booting my kernel-modules.

Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>

Just as a side-note:
As with Linux v5.18-rc1 and -std=gnu11 we change the above comment ...?

# The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
KBUILD_CFLAGS += -Wno-gnu

- Sedat -

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] kbuild: Remove '-mno-global-merge'
  2022-03-31  7:11   ` Sedat Dilek
@ 2022-03-31 15:37     ` Nathan Chancellor
  2022-03-31 18:52       ` Sedat Dilek
  0 siblings, 1 reply; 11+ messages in thread
From: Nathan Chancellor @ 2022-03-31 15:37 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook, linux-kbuild,
	linux-kernel, linux-um, llvm, patches

On Thu, Mar 31, 2022 at 09:11:12AM +0200, Sedat Dilek wrote:
> On Thu, Mar 31, 2022 at 5:27 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > 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 <nathan@kernel.org>
> > ---
> >  Makefile | 4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index daeb5c88b50b..f2723d9bfca4 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -784,10 +784,6 @@ ifdef CONFIG_CC_IS_CLANG
> >  KBUILD_CPPFLAGS += -Qunused-arguments
> >  # The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
> >  KBUILD_CFLAGS += -Wno-gnu
> > -# 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
> >  else
> >
> >  # gcc inanely warns about local variables called 'main'
> > --
> > 2.35.1
> >
> 
> I have tested this several times and was able to boot into bar metal -
> no problems with building and/or booting my kernel-modules.
> 
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>

I would be very concerned if you did see any impact, given this flag is
ARM specific :) thanks as always for verifying!

> Just as a side-note:
> As with Linux v5.18-rc1 and -std=gnu11 we change the above comment ...?
> 
> # The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
> KBUILD_CFLAGS += -Wno-gnu

It was updated as part of the shift to '-std=gnu11':

https://git.kernel.org/linus/e8c07082a810fbb9db303a2b66b66b8d7e588b53

The UML tree is based on 5.17-rc6, which does not have that change.
There should not be a merge conflict though.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] kbuild: Remove '-mno-global-merge'
  2022-03-31 15:37     ` Nathan Chancellor
@ 2022-03-31 18:52       ` Sedat Dilek
  0 siblings, 0 replies; 11+ messages in thread
From: Sedat Dilek @ 2022-03-31 18:52 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Nick Desaulniers, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Kees Cook, linux-kbuild,
	linux-kernel, linux-um, llvm, patches

On Thu, Mar 31, 2022 at 5:37 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Thu, Mar 31, 2022 at 09:11:12AM +0200, Sedat Dilek wrote:
> > On Thu, Mar 31, 2022 at 5:27 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > 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 <nathan@kernel.org>
> > > ---
> > >  Makefile | 4 ----
> > >  1 file changed, 4 deletions(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index daeb5c88b50b..f2723d9bfca4 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -784,10 +784,6 @@ ifdef CONFIG_CC_IS_CLANG
> > >  KBUILD_CPPFLAGS += -Qunused-arguments
> > >  # The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
> > >  KBUILD_CFLAGS += -Wno-gnu
> > > -# 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
> > >  else
> > >
> > >  # gcc inanely warns about local variables called 'main'
> > > --
> > > 2.35.1
> > >
> >
> > I have tested this several times and was able to boot into bar metal -
> > no problems with building and/or booting my kernel-modules.
> >
> > Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
> > Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
>
> I would be very concerned if you did see any impact, given this flag is
> ARM specific :) thanks as always for verifying!
>
> > Just as a side-note:
> > As with Linux v5.18-rc1 and -std=gnu11 we change the above comment ...?
> >
> > # The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
> > KBUILD_CFLAGS += -Wno-gnu
>
> It was updated as part of the shift to '-std=gnu11':
>
> https://git.kernel.org/linus/e8c07082a810fbb9db303a2b66b66b8d7e588b53
>
> The UML tree is based on 5.17-rc6, which does not have that change.
> There should not be a merge conflict though.
>

Ah OK, a different base for UML.

- Sedat -

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS
  2022-03-30 23:45 [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS Nathan Chancellor
  2022-03-30 23:45 ` [PATCH 1/2] kbuild: Remove '-mno-global-merge' Nathan Chancellor
  2022-03-30 23:45 ` [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS" Nathan Chancellor
@ 2022-04-01 13:03 ` Masahiro Yamada
  2 siblings, 0 replies; 11+ messages in thread
From: Masahiro Yamada @ 2022-04-01 13:03 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nick Desaulniers, Richard Weinberger, Anton Ivanov,
	Johannes Berg, Kees Cook, Linux Kbuild mailing list,
	Linux Kernel Mailing List, linux-um, llvm, patches

On Thu, Mar 31, 2022 at 8:46 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> As discussed at [1] and [2], this series removes '-mno-global-merge'
> from KBUILD_CFLAGS for clang, as it causes warnings for UML, and it
> no longer appears to be necessary, as I do not see any modpost warnings
> with LLVM 11 through 15 with several different ARCH=arm and ARCH=arm64
> configurations.
>
> [1] is currently in the UML tree, destined for 5.18, but it is buggy, as
> I note in [2]. This series is an alternative to [2], which has not been
> picked up yet, so it is based on the current UML tree. If [2] is picked
> up, I can rework the first patch to remove the '-mno-global-merge'
> filtering from arch/um/Makefile; otherwise, this should be picked up in
> place of [2].
>
> I intentionally kept the first patch vague around what fixed the modpost
> warnings, as I am not too sure. [3] seems somewhat likely, but I don't
> think that will revert cleanly on main to test. I think the testing is
> enough to show that the original issue is resolved but I do note that we
> can add this flag back in the architecture specific Makefiles if needed.
>
> Please review and ack as necessary.


Both applied to linux-kbuild/fixes.




> [1]: https://lore.kernel.org/r/20220303090643.241747-1-davidgow@google.com/
> [2]: https://lore.kernel.org/r/20220322173547.677760-1-nathan@kernel.org/
> [3]: https://github.com/llvm/llvm-project/commit/863bfdbfb446adaef767ff514d1f2ffb5d489562
>
> Nathan Chancellor (2):
>   kbuild: Remove '-mno-global-merge'
>   Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS"
>
>  Makefile         | 4 ----
>  arch/um/Makefile | 4 ----
>  2 files changed, 8 deletions(-)
>
>
> base-commit: 82017457957a550d7d00dde419435dd74a890887
> --
> 2.35.1
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-04-01 13:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30 23:45 [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS Nathan Chancellor
2022-03-30 23:45 ` [PATCH 1/2] kbuild: Remove '-mno-global-merge' Nathan Chancellor
2022-03-31  1:59   ` David Gow
2022-03-31  4:57   ` Kees Cook
2022-03-31  7:11   ` Sedat Dilek
2022-03-31 15:37     ` Nathan Chancellor
2022-03-31 18:52       ` Sedat Dilek
2022-03-30 23:45 ` [PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS" Nathan Chancellor
2022-03-31  2:00   ` David Gow
2022-03-31  4:58   ` Kees Cook
2022-04-01 13:03 ` [PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS Masahiro Yamada

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).