[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181126105047.521454664@linuxfoundation.org>
Date: Mon, 26 Nov 2018 11:50:21 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Behan Webster <behanw@...verseincode.com>,
Jan-Simon Möller <dl9pf@....de>,
Mark Charlebois <charlebm@...il.com>,
Greg Hackmann <ghackmann@...gle.com>,
Matthias Kaehlcke <mka@...omium.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Nathan Chancellor <natechancellor@...il.com>
Subject: [PATCH 4.4 06/70] kbuild: Add better clang cross build support
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Behan Webster <behanw@...verseincode.com>
commit 785f11aa595bc3d4e74096cbd598ada54ecc0d81 upstream.
Add cross target to CC if using clang. Also add custom gcc toolchain
path for fallback gcc tools.
Clang will fallback to using things like ld, as, and libgcc if
(respectively) one of the llvm linkers isn't available, the integrated
assembler is turned off, or an appropriately cross-compiled version of
compiler-rt isn't available. To this end, you can specify the path to
this fallback gcc toolchain with GCC_TOOLCHAIN.
Signed-off-by: Behan Webster <behanw@...verseincode.com>
Reviewed-by: Jan-Simon Möller <dl9pf@....de>
Reviewed-by: Mark Charlebois <charlebm@...il.com>
Signed-off-by: Greg Hackmann <ghackmann@...gle.com>
Signed-off-by: Matthias Kaehlcke <mka@...omium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
Makefile | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/Makefile
+++ b/Makefile
@@ -698,6 +698,15 @@ endif
KBUILD_CFLAGS += $(stackp-flag)
ifeq ($(cc-name),clang)
+ifneq ($(CROSS_COMPILE),)
+CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%))
+GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..)
+endif
+ifneq ($(GCC_TOOLCHAIN),)
+CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN)
+endif
+KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
+KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
Powered by blists - more mailing lists