]> granicus.if.org Git - clang/commitdiff
Look for libstdc++ first on the clang install directory.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 28 Aug 2013 23:17:47 +0000 (23:17 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 28 Aug 2013 23:17:47 +0000 (23:17 +0000)
When sysroot is not set, look for libstdc++ first on the clang install
directory. Before this change if clang was installed alongside a gcc with
the same version as the system one we would select the system libstdc++.

Unfortunately this is hard to test as only the non-sysroot case is changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189536 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp

index 58847c8aac4e883c2cd183e2ef2c211944d222ef..7025a9931fc3a8a68be6909e0207a0305aff5f9c 100644 (file)
@@ -1021,9 +1021,18 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(
 
     Prefixes.push_back(GCCToolchainDir);
   } else {
-    Prefixes.push_back(D.SysRoot);
-    Prefixes.push_back(D.SysRoot + "/usr");
+    // If we have a SysRoot, try that first.
+    if (!D.SysRoot.empty()) {
+      Prefixes.push_back(D.SysRoot);
+      Prefixes.push_back(D.SysRoot + "/usr");
+    }
+
+    // Then look for gcc installed alongside clang.
     Prefixes.push_back(D.InstalledDir + "/..");
+
+    // And finally in /usr.
+    if (D.SysRoot.empty())
+      Prefixes.push_back("/usr");
   }
 
   // Loop over the various components which exist and select the best GCC