Skip to content

Commit d97498d

Browse files
greghackmannpundiramit
authored andcommitted
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: Ib544c37f4ee4ed005437471b2984486a3e7c0da7 Signed-off-by: Greg Hackmann <ghackmann@google.com>
1 parent a072e74 commit d97498d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,8 @@ KBUILD_CFLAGS += $(stackp-flag)
695695

696696
ifeq ($(cc-name),clang)
697697
ifneq ($(CROSS_COMPILE),)
698-
CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%))
698+
CLANG_TRIPLE ?= $(CROSS_COMPILE)
699+
CLANG_TARGET := -target $(notdir $(CLANG_TRIPLE:%-=%))
699700
GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..)
700701
endif
701702
ifneq ($(GCC_TOOLCHAIN),)

0 commit comments

Comments
 (0)