summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains/Linux.cpp
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2018-04-17 20:42:07 +0000
committerDan Albert <danalbert@google.com>2018-04-17 20:42:07 +0000
commitf4832793924d1321f2b95622bce2405835351070 (patch)
tree8abb934e6298a926700e2075deca51924ebb47db /clang/lib/Driver/ToolChains/Linux.cpp
parent005aadaa0de15e9aeeea5763a3bf696c1abb9095 (diff)
downloadbcm5719-llvm-f4832793924d1321f2b95622bce2405835351070.tar.gz
bcm5719-llvm-f4832793924d1321f2b95622bce2405835351070.zip
[Driver] Use the per-API level Android library directories.
Summary: Android sysroots contain libraries for each OS version, as well as a handful of unversioned libraries in the typical multiarch directory. Reviewers: srhines, eugenis, george.burgess.iv Reviewed By: eugenis Subscribers: javed.absar, cfe-commits Differential Revision: https://reviews.llvm.org/D45290 llvm-svn: 330213
Diffstat (limited to 'clang/lib/Driver/ToolChains/Linux.cpp')
-rw-r--r--clang/lib/Driver/ToolChains/Linux.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 5473be2c1e7..e584fcd6b08 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -22,6 +22,7 @@
#include "llvm/Option/ArgList.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/ScopedPrinter.h"
#include <system_error>
using namespace clang::driver;
@@ -350,6 +351,21 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
+
+ if (IsAndroid) {
+ // Android sysroots contain a library directory for each supported OS
+ // version as well as some unversioned libraries in the usual multiarch
+ // directory.
+ unsigned Major;
+ unsigned Minor;
+ unsigned Micro;
+ Triple.getEnvironmentVersion(Major, Minor, Micro);
+ addPathIfExists(D,
+ SysRoot + "/usr/lib/" + MultiarchTriple + "/" +
+ llvm::to_string(Major),
+ Paths);
+ }
+
addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
if (IsRISCV) {
OpenPOWER on IntegriCloud