[llvm-branch-commits] [cfe-branch] r143953 - in /cfe/branches/release_30: ./ lib/Driver/ToolChains.cpp

Chandler Carruth chandlerc at gmail.com
Mon Nov 7 02:43:26 PST 2011


Author: chandlerc
Date: Mon Nov  7 04:43:26 2011
New Revision: 143953

URL: http://llvm.org/viewvc/llvm-project?rev=143953&view=rev
Log:
Merging r143896:
------------------------------------------------------------------------
r143896 | chandlerc | 2011-11-06 15:09:05 -0800 (Sun, 06 Nov 2011) | 3 lines

Remove the HasMultilib check. It was essentially useless. The driver now
looks for evidence of a multilib installation, and adds the appropriate
bits to the search paths.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_30/   (props changed)
    cfe/branches/release_30/lib/Driver/ToolChains.cpp

Propchange: cfe/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov  7 04:43:26 2011
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798,143801,143804-143807,143822-143823,143836,143838-143842,143863,143866,143869,143871,143873-143875
+/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798,143801,143804-143807,143822-143823,143836,143838-143842,143863,143866,143869,143871,143873-143875,143896
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_30/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Driver/ToolChains.cpp?rev=143953&r1=143952&r2=143953&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Driver/ToolChains.cpp (original)
+++ cfe/branches/release_30/lib/Driver/ToolChains.cpp Mon Nov  7 04:43:26 2011
@@ -1424,19 +1424,6 @@
          Distro == UbuntuNatty  || Distro == UbuntuOneiric;
 }
 
-// FIXME: This should be deleted. We should assume a multilib environment, and
-// fallback gracefully if any parts of it are absent.
-static bool HasMultilib(llvm::Triple::ArchType Arch, enum LinuxDistro Distro) {
-  if (Arch == llvm::Triple::x86_64) {
-    bool Exists;
-    if (Distro == Exherbo &&
-        (llvm::sys::fs::exists("/usr/lib32/libc.so", Exists) || !Exists))
-      return false;
-  }
-
-  return true;
-}
-
 static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
   llvm::OwningPtr<llvm::MemoryBuffer> File;
   if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) {
@@ -1857,42 +1844,37 @@
   const std::string Multilib = Is32Bits ? "lib32" : "lib64";
   const std::string MultiarchTriple = getMultiarchTriple(Triple, SysRoot);
 
-  // FIXME: Because we add paths only when they exist on the system, I think we
-  // should remove the concept of 'HasMultilib'. It's more likely to break the
-  // behavior than to preserve any useful invariant on the system.
-  if (HasMultilib(Arch, Distro)) {
-    // Add the multilib suffixed paths.
-    if (GCCInstallation.isValid()) {
-      const std::string &LibPath = GCCInstallation.getParentLibPath();
-      const std::string &GccTriple = GCCInstallation.getTriple();
-      // FIXME: This OpenSuse-specific path shouldn't be needed any more, but
-      // I don't want to remove it without finding someone to test.
-      if (IsOpenSuse(Distro) && Is32Bits)
-        Paths.push_back(LibPath + "/../" + GccTriple + "/lib/../lib");
-
-      addPathIfExists(GCCInstallation.getInstallPath() + Suffix, Paths);
-      addPathIfExists(LibPath + "/../" + GccTriple + "/lib/../" + Multilib,
-                      Paths);
-      addPathIfExists(LibPath + "/" + MultiarchTriple, Paths);
-      addPathIfExists(LibPath + "/../" + Multilib, Paths);
-    }
-    addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths);
-    addPathIfExists(SysRoot + "/lib/../" + Multilib, Paths);
-    addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
-    addPathIfExists(SysRoot + "/usr/lib/../" + Multilib, Paths);
-
-    // Try walking via the GCC triple path in case of multiarch GCC
-    // installations with strange symlinks.
-    if (GCCInstallation.isValid())
-      addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple() +
-                      "/../../" + Multilib, Paths);
+  // Add the multilib suffixed paths where they are available.
+  if (GCCInstallation.isValid()) {
+    const std::string &LibPath = GCCInstallation.getParentLibPath();
+    const std::string &GccTriple = GCCInstallation.getTriple();
+    // FIXME: This OpenSuse-specific path shouldn't be needed any more, but
+    // I don't want to remove it without finding someone to test.
+    if (IsOpenSuse(Distro) && Is32Bits)
+      Paths.push_back(LibPath + "/../" + GccTriple + "/lib/../lib");
+
+    addPathIfExists(GCCInstallation.getInstallPath() + Suffix, Paths);
+    addPathIfExists(LibPath + "/../" + GccTriple + "/lib/../" + Multilib,
+                    Paths);
+    addPathIfExists(LibPath + "/" + MultiarchTriple, Paths);
+    addPathIfExists(LibPath + "/../" + Multilib, Paths);
   }
+  addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths);
+  addPathIfExists(SysRoot + "/lib/../" + Multilib, Paths);
+  addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
+  addPathIfExists(SysRoot + "/usr/lib/../" + Multilib, Paths);
+
+  // Try walking via the GCC triple path in case of multiarch GCC
+  // installations with strange symlinks.
+  if (GCCInstallation.isValid())
+    addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple() +
+                    "/../../" + Multilib, Paths);
 
   // Add the non-multilib suffixed paths (if potentially different).
   if (GCCInstallation.isValid()) {
     const std::string &LibPath = GCCInstallation.getParentLibPath();
     const std::string &GccTriple = GCCInstallation.getTriple();
-    if (!Suffix.empty() || !HasMultilib(Arch, Distro))
+    if (!Suffix.empty())
       addPathIfExists(GCCInstallation.getInstallPath(), Paths);
     addPathIfExists(LibPath + "/../" + GccTriple + "/lib", Paths);
     addPathIfExists(LibPath + "/" + MultiarchTriple, Paths);





More information about the llvm-branch-commits mailing list