Index: clang/lib/Driver/ToolChains/Gnu.h =================================================================== --- clang/lib/Driver/ToolChains/Gnu.h +++ clang/lib/Driver/ToolChains/Gnu.h @@ -250,6 +250,7 @@ void print(raw_ostream &OS) const; private: + std::string TripleNoVendor; static void CollectLibDirsAndTriples(const llvm::Triple &TargetTriple, const llvm::Triple &BiarchTriple, Index: clang/lib/Driver/ToolChains/Gnu.cpp =================================================================== --- clang/lib/Driver/ToolChains/Gnu.cpp +++ clang/lib/Driver/ToolChains/Gnu.cpp @@ -2085,6 +2085,10 @@ CandidateTripleAliases, CandidateBiarchLibDirs, CandidateBiarchTripleAliases); + TripleNoVendor = TargetTriple.getArchName().str() + "-" + + TargetTriple.getOSAndEnvironmentName().str(); + StringRef TripleNoVendorRef(TripleNoVendor); + // If --gcc-install-dir= is specified, skip filesystem detection. if (const Arg *A = Args.getLastArg(clang::driver::options::OPT_gcc_install_dir_EQ); @@ -2170,6 +2174,10 @@ // Try to match the exact target triple first. ScanLibDirForGCCTriple(TargetTriple, Args, LibDir, TargetTriple.str(), false, GCCDirExists, GCCCrossDirExists); + // If vendor is unknown, let's try triple without vendor. + if (TargetTriple.getVendor() == llvm::Triple::UnknownVendor) + ScanLibDirForGCCTriple(TargetTriple, Args, LibDir, TripleNoVendorRef, + false, GCCDirExists, GCCCrossDirExists); // Try rest of possible triples. for (StringRef Candidate : ExtraTripleAliases) // Try these first. ScanLibDirForGCCTriple(TargetTriple, Args, LibDir, Candidate, false,