ANDROID: Kbuild, LLVMLinux: allow overriding clang target triple
authorGreg Hackmann <ghackmann@google.com>
Tue, 25 Oct 2016 20:59:59 +0000 (13:59 -0700)
committerAlistair Strachan <astrachan@google.com>
Wed, 28 Nov 2018 02:06:36 +0000 (18:06 -0800)
commit9ff6ab2fbc0052a9e81d1eeb168cf78832dcbb6b
tree39b6675bdb2aed115f98e183c9ef878484d88f79
parentf544ad0b154702daed947248cf75b840181c1aa2
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: I85d63599c6ab8ed458071cdf9197d85b1f7f150b
Signed-off-by: Greg Hackmann <ghackmann@google.com>
[astrachan: Added a script to check for incorrectly falling back to the
            default when CLANG_TRIPLE is unset]
Bug: 118439987
Signed-off-by: Alistair Strachan <astrachan@google.com>
Makefile
scripts/clang-android.sh [new file with mode: 0755]