diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Driver/ToolChains/Linux.cpp | 16 |
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) { |