This patch adds the OS-specific resource directory ($resourcedir/lib/$os) to 
the default file search paths when invoking Driver::GetFilePath.
This allows it to find the non-generic files it may need, as well as making the 
GCC-compatible driver's -print-file-name work with e.g. the libclang_rt.*.a 
files.

http://reviews.llvm.org/D10049

Files:
  lib/Driver/Driver.cpp

Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1857,6 +1857,14 @@
   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) {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1857,6 +1857,14 @@
   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) {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to