linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: drop CROSS_COMPILE for LLVM=1 LLVM_IAS=1
@ 2021-07-01 23:55 Nick Desaulniers
  2021-07-02  1:05 ` Tom Stellard
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Nick Desaulniers @ 2021-07-01 23:55 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Masahiro Yamada, Nick Desaulniers, Arnd Bergmann, Fangrui Song,
	Nathan Chancellor, linux-arm-kernel, linux-kernel,
	clang-built-linux

We get constant feedback that the command line invocation of make is too
long. CROSS_COMPILE is helpful when a toolchain has a prefix of the
target triple, or is an absolute path outside of $PATH, but it's mostly
redundant for a given ARCH.

If CROSS_COMPILE is not set, simply set --target=aarch64-linux for
CLANG_FLAGS, KBUILD_CFLAGS, and KBUILD_AFLAGS.

Previously, we'd cross compile via:
$ ARCH=arm64 CROSS_COMPILE=aarch64-linxu-gnu make LLVM=1 LLVM_IAS=1
Now:
$ ARCH=arm64 make LLVM=1 LLVM_IAS=1

We can drop gnu from the triple, but dropping linux from the triple
produces different .config files for the above invocations for the
defconfig target.

Link: https://github.com/ClangBuiltLinux/linux/issues/1399
Suggested-by: Arnd Bergmann <arnd@kernel.org>
Suggested-by: Fangrui Song <maskray@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/arm64/Makefile | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 7bc37d0a1b68..016873fddcc3 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -34,6 +34,17 @@ $(warning LSE atomics not supported by binutils)
   endif
 endif
 
+ifneq ($(LLVM),)
+ifneq ($(LLVM_IAS),)
+ifeq ($(CROSS_COMPILE),)
+CLANG_TARGET	:=--target=aarch64-linux
+CLANG_FLAGS	+= $(CLANG_TARGET)
+KBUILD_CFLAGS	+= $(CLANG_TARGET)
+KBUILD_AFLAGS	+= $(CLANG_TARGET)
+endif
+endif
+endif
+
 cc_has_k_constraint := $(call try-run,echo				\
 	'int main(void) {						\
 		asm volatile("and w0, w0, %w0" :: "K" (4294967295));	\
-- 
2.32.0.93.g670b81a890-goog


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

end of thread, other threads:[~2021-07-07 22:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 23:55 [PATCH] arm64: drop CROSS_COMPILE for LLVM=1 LLVM_IAS=1 Nick Desaulniers
2021-07-02  1:05 ` Tom Stellard
2021-07-02 17:37   ` Nick Desaulniers
2021-07-02 11:22 ` Will Deacon
2021-07-02 17:50   ` Nick Desaulniers
2021-07-02 11:59 ` Arnd Bergmann
2021-07-02 18:29   ` Nick Desaulniers
2021-07-04  0:47     ` Nathan Chancellor
2021-07-07 19:04       ` Nick Desaulniers
2021-07-07 19:08         ` Nathan Chancellor
2021-07-07 22:44           ` Nick Desaulniers

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