[PATCH] D21163: Strip Android version when looking up toolchain paths.

Josh Gao via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 8 18:16:30 PDT 2016


jmgao created this revision.
jmgao added reviewers: srhines, danalbert.
jmgao added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer, aemerson.

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.

http://reviews.llvm.org/D21163

Files:
  lib/Driver/Driver.cpp

Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2283,7 +2283,15 @@
     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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21163.60126.patch
Type: text/x-patch
Size: 776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160609/979a4f92/attachment-0001.bin>


More information about the cfe-commits mailing list