From 4dd630f30db527c2d63fdd65e892c50e831ac3cd Mon Sep 17 00:00:00 2001 From: Shiz Date: Wed, 27 May 2015 00:31:59 +0000 Subject: [PATCH 1/4] Add OS-specific resource directory to file search paths. This makes -print-file-name and other Driver::GetFilePath operations work with libclang_rt.*.a, as well as the other files located in $prefix/lib/clang/$version/lib/$os. --- lib/Driver/Driver.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 65d0049..724eccd 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1857,6 +1857,14 @@ std::string Driver::GetFilePath(const char *Name, const ToolChain &TC) const { if (llvm::sys::fs::exists(Twine(P))) return P.str(); + P = ResourceDir; + // TC.getOSName() yields "freebsd10.0" whereas "freebsd" is expected. + StringRef OSLibName = (TC.getTriple().getOS() == llvm::Triple::FreeBSD) + ? "freebsd" : TC.getTriple().getOSName(); + llvm::sys::path::append(P, "lib", OSLibName, Name); + if (llvm::sys::fs::exists(Twine(P))) + return P.str(); + const ToolChain::path_list &List = TC.getFilePaths(); for (ToolChain::path_list::const_iterator it = List.begin(), ie = List.end(); it != ie; ++it) { -- 2.3.6