Commit ce9034fb authored by Chandler Carruth's avatar Chandler Carruth
Browse files

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.
------------------------------------------------------------------------

llvm-svn: 143953
parent 5aaaf48c
Loading
Loading
Loading
Loading
+25 −43
Original line number Diff line number Diff line
@@ -1424,19 +1424,6 @@ static bool IsUbuntu(enum LinuxDistro Distro) {
         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,11 +1844,7 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
  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.
  // Add the multilib suffixed paths where they are available.
  if (GCCInstallation.isValid()) {
    const std::string &LibPath = GCCInstallation.getParentLibPath();
    const std::string &GccTriple = GCCInstallation.getTriple();
@@ -1886,13 +1869,12 @@ Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
  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);