Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46817c9a authored by Greg Hackmann's avatar Greg Hackmann Committed by Satya Durga Srinivasu Prabhala
Browse files

ANDROID: Kbuild, LLVMLinux: allow overriding clang target triple



Android has an unusual setup where the kernel needs to target
[arch]-linux-gnu to avoid Android userspace-specific flags and
optimizations, but AOSP doesn't ship a matching binutils.

Add a new variable CLANG_TRIPLE which can override the "-target" triple
used to compile the kernel, while using a different CROSS_COMPILE to
pick the binutils/gcc installation.  For Android you'd do something
like:

  export CLANG_TRIPLE=aarch64-linux-gnu-
  export CROSS_COMPILE=aarch64-linux-android-

If you don't need something like this, leave CLANG_TRIPLE unset and it
will default to CROSS_COMPILE.

Change-Id: I6b2c100bd5d751997e142a7088a1095f35f7640c
Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
Git-commit: 12d62000883481ca0d4e9020be90aab8b8d47de6
Git-repo: https://android.googlesource.com/kernel/common/


[satyap@codeaurora.org: resolution of trivial merge conflicts]
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent 96d47aed
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -379,7 +379,6 @@ LDFLAGS_vmlinux =
CFLAGS_GCOV	:= -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disable-warning,maybe-uninitialized,)
CFLAGS_KCOV	:= $(call cc-option,-fsanitize-coverage=trace-pc,)


# Use USERINCLUDE when you must reference the UAPI directories only.
USERINCLUDE    := \
		-I$(srctree)/arch/$(hdr-arch)/include/uapi \
@@ -699,7 +698,8 @@ KBUILD_CFLAGS += $(stackp-flag)

ifeq ($(cc-name),clang)
ifneq ($(CROSS_COMPILE),)
CLANG_TARGET	:= -target $(notdir $(CROSS_COMPILE:%-=%))
CLANG_TRIPLE	?= $(CROSS_COMPILE)
CLANG_TARGET	:= -target $(notdir $(CLANG_TRIPLE:%-=%))
GCC_TOOLCHAIN	:= $(realpath $(dir $(shell which $(LD)))/..)
endif
ifneq ($(GCC_TOOLCHAIN),)