diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2018-10-22 19:48:08 +0000 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2018-10-22 19:48:08 +0000 |
commit | 90b379f2192df869cd4354de774f573fd6ddfa63 (patch) | |
tree | 2ad427d5cc99ff4ddc07ebdf642847500b06bb55 /test | |
parent | 41e165b659ec7d8262153a6e0ed9130431c886de (diff) |
[Driver] allow Android triples to alias for non Android targets
Summary:
Partial revert of r330873 ('[Driver] Reland "Android triples are not
aliases for other triples."')
While we don't want `-target *-linux-android` to alias to non
*-linux-android libs and binaries, it turns out we do want the
opposite. Ie. We would like for `-target *-linux-gnu` to still be
able to use *-android libs and binaries.
In fact, this is used to cross assemble and link the Linux kernel for
Android devices.
`-target *-linux-gnu` needs to be used for the Linux kernel when
using the android binutils prebuilts (*-linux-android).
The use of `-target *-linux-android` on C source files will cause
Clang to perform optimizations based on the presence of bionic (due to
r265481 ('Faster stack-protector for Android/AArch64.')) which is
invalid within the Linux kernel and will produce a non-bootable kernel
image.
Of course, you could just use the standard binutils (*-linux-gnu),
but Android does not distribute these. So this patch fixes a problem
that only occurs when cross assembling and linking a Linux kernel with
the Android provided binutils, which is what is done within Android's
build system.
Reviewers: srhines, pirama, danalbert
Reviewed By: srhines, danalbert
Subscribers: javed.absar, kristof.beyls, cfe-commits
Differential Revision: https://reviews.llvm.org/D53463
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344941 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Driver/android-gcc-toolchain.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Driver/android-gcc-toolchain.c b/test/Driver/android-gcc-toolchain.c new file mode 100644 index 0000000000..560d469aaf --- /dev/null +++ b/test/Driver/android-gcc-toolchain.c @@ -0,0 +1,8 @@ +// Test that gcc-toolchain option works correctly with a aarch64-linux-gnu +// triple. +// +// RUN: %clang %s -### -v --target=aarch64-linux-gnu \ +// RUN: --gcc-toolchain=%S/Inputs/basic_android_ndk_tree/ 2>&1 \ +// RUN: | FileCheck %s +// +// CHECK: Found candidate GCC installation: {{.*}}/Inputs/basic_android_ndk_tree/lib/gcc/aarch64-linux-android/4.9 |