All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS
@ 2022-03-03  9:06 ` David Gow
  0 siblings, 0 replies; 13+ messages in thread
From: David Gow @ 2022-03-03  9:06 UTC (permalink / raw)
  To: Kees Cook
  Cc: David Gow, Jeff Dike, Richard Weinberger, Anton Ivanov,
	Masahiro Yamada, Nick Desaulniers, Nathan Chancellor, linux-um,
	linux-kbuild, linux-kselftest, kunit-dev, llvm, linux-kernel,
	linux-hardening

The things built with USER_CFLAGS don't seem to recognise it as a
compiler option, and print a warning:
clang: warning: argument unused during compilation: '-mno-global-merge' [-Wunused-command-line-argument]

Fixes: 744814d2fa ("um: Allow builds with Clang")
Signed-off-by: David Gow <davidgow@google.com>
---

This warning shows up after merging:
https://lore.kernel.org/lkml/20220227184517.504931-6-keescook@chromium.org/

I'm not 100% sure why this is necessary, but it does seem to work. All
the attempts to get rid of -mno-global-merge entirely have been met with
skepticism, but I'm guessing that it's not a problem for just the UML
"user" files, as they shouldn't(?) interact too much with modules.

 arch/um/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index f2fe63bfd819..320b09cd513c 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -75,6 +75,10 @@ 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.616.g0bdcbb4464-goog


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

end of thread, other threads:[~2022-03-04 11:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03  9:06 [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS David Gow
2022-03-03  9:06 ` David Gow
2022-03-03 17:30 ` Nathan Chancellor
2022-03-03 17:30   ` Nathan Chancellor
2022-03-03 18:04   ` Kees Cook
2022-03-03 18:26     ` Nathan Chancellor
2022-03-03 18:26       ` Nathan Chancellor
2022-03-03 18:39       ` Nick Desaulniers
2022-03-03 18:39         ` Nick Desaulniers
2022-03-04 11:42         ` Sedat Dilek
2022-03-04 11:42           ` Sedat Dilek
2022-03-04  6:51   ` David Gow
2022-03-04  6:51     ` David Gow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.