From: behanw@converseincode.com
To: mmarek@suse.cz
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Behan Webster <behanw@converseincode.com>
Subject: [PATCH] kbuild, LLVMLinux: Add better clang cross build support
Date: Fri, 5 Sep 2014 17:21:49 -0700 [thread overview]
Message-ID: <1409962909-14660-1-git-send-email-behanw@converseincode.com> (raw)
From: Behan Webster <behanw@converseincode.com>
Add cross target to CC if using clang. Also add custom gcc toolchain path for
fallback gcc tools.
COMPILER is previously set to "clang" if CC=clang was set from the make command
line. So -target and -gcc-toolchain can be added to CC, since we already know
that it is set.
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@converseincode.com>
---
Makefile | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Makefile b/Makefile
index 2893d7f..c772619 100644
--- a/Makefile
+++ b/Makefile
@@ -360,7 +360,16 @@ include $(srctree)/scripts/Kbuild.include
# Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
+ifeq ($(COMPILER),clang)
+ifneq ($(CROSS_COMPILE),)
+CC += -target $(CROSS_COMPILE:%-=%)
+endif
+ifneq ($(GCC_TOOLCHAIN),)
+CC += -gcc-toolchain $(GCC_TOOLCHAIN)
+endif
+else
CC = $(CROSS_COMPILE)gcc
+endif
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
--
1.9.1
reply other threads:[~2014-09-06 0:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409962909-14660-1-git-send-email-behanw@converseincode.com \
--to=behanw@converseincode.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®