Author: rafael
Date: Mon May  9 08:03:10 2016
New Revision: 268912

URL: http://llvm.org/viewvc/llvm-project?rev=268912&view=rev
Log:
RHEL: Look in more places to find g++ headers and runtime.

Some distros with ten years of support ship an old gcc but later offer
more recent versions for installation in parallel. These versions are
typically not only needed for the compilation of llvm/clang, but also to
properly use the clang binary that comes out.

Clang already searches /usr at runtime for the most recent installation
of gcc. This patch appends paths for add-on installations of gcc in
RHEL.

Patch by Michael Lampe.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=268912&r1=268911&r2=268912&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon May  9 08:03:10 2016
@@ -1410,9 +1410,17 @@ void Generic_GCC::GCCInstallationDetecto
     // Then look for gcc installed alongside clang.
     Prefixes.push_back(D.InstalledDir + "/..");
 
-    // And finally in /usr.
-    if (D.SysRoot.empty())
+    // Then look for distribution supplied gcc installations.
+    if (D.SysRoot.empty()) {
+      // Look for RHEL devtoolsets.
+      Prefixes.push_back("/opt/rh/devtoolset-4/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-3/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-2/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-1.1/root/usr");
+      Prefixes.push_back("/opt/rh/devtoolset-1.0/root/usr");
+      // And finally in /usr.
       Prefixes.push_back("/usr");
+    }
   }
 
   // Loop over the various components which exist and select the best GCC


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to