forked from OSchip/llvm-project
Strip Android version when looking up toolchain paths.
Summary: Android target triples can include a version number in the abi field (e.g. 'aarch64-linux-android21'), used for checking for availability. However, the driver was searching for toolchain binaries using the passed in triple as a prefix. Reviewers: srhines, danalbert, t.p.northover Subscribers: t.p.northover, aemerson, tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D21163 llvm-svn: 272413
This commit is contained in:
parent
b2b0da4ad0
commit
4e9cef0491
|
@ -2343,7 +2343,15 @@ void Driver::generatePrefixedToolNames(
|
|||
const char *Tool, const ToolChain &TC,
|
||||
SmallVectorImpl<std::string> &Names) const {
|
||||
// FIXME: Needs a better variable than DefaultTargetTriple
|
||||
Names.emplace_back(DefaultTargetTriple + "-" + Tool);
|
||||
StringRef Triple = DefaultTargetTriple;
|
||||
|
||||
// On Android, the target triple can include a version number that needs to
|
||||
// be stripped.
|
||||
if (TC.getTriple().isAndroid()) {
|
||||
Triple = Triple.rtrim("0123456789");
|
||||
}
|
||||
|
||||
Names.emplace_back((Triple + "-" + Tool).str());
|
||||
Names.emplace_back(Tool);
|
||||
|
||||
// Allow the discovery of tools prefixed with LLVM's default target triple.
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// Android's target triples can contain a version number in the environment
|
||||
// field (e.g. arm-linux-androideabi9).
|
||||
// Make sure that any version is stripped when finding toolchain binaries.
|
||||
|
||||
// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
|
||||
// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | FileCheck %s
|
||||
// RUN: env "PATH=%S/Inputs/android_triple_version/bin" \
|
||||
// RUN: %clang -### -target arm-linux-androideabi9 %s 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: arm-linux-androideabi-ld
|
Loading…
Reference in New Issue