]> granicus.if.org Git - clang/commitdiff
Switch FreeBSD to just include both '/usr/lib32' and '/usr/lib' in the
authorChandler Carruth <chandlerc@gmail.com>
Wed, 25 Jan 2012 08:04:15 +0000 (08:04 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 25 Jan 2012 08:04:15 +0000 (08:04 +0000)
search paths for 32-bit targets. This avoids having to detect which is
expected for the target system, and the linker should DTRT, and take the
32-bit libraries from the first one when applicable. Thanks to Roman
Divacky for sanity checking this.

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

lib/Driver/ToolChains.cpp

index ba0c2b431bf0d17e734a46f56b79070fdb8cfd6a..6b8168e68687a3af2a0a326f15c2a1c690e2aa60 100644 (file)
@@ -1628,23 +1628,14 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA,
 FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple)
   : Generic_ELF(Host, Triple) {
 
-  // Determine if we are compiling 32-bit code on an x86_64 platform.
-  bool Lib32 = false;
-  // FIXME: This is using the Driver's target triple as the host triple!
-  if (Triple.getArch() == llvm::Triple::x86 &&
-      getDriver().TargetTriple.getArch() == llvm::Triple::x86_64)
-    Lib32 = true;
-
-  // FIXME: This is using the Driver's target triple as the host triple!
-  if (Triple.getArch() == llvm::Triple::ppc &&
-      getDriver().TargetTriple.getArch() == llvm::Triple::ppc64)
-    Lib32 = true;
-
-  if (Lib32) {
+  // When targeting 32-bit platforms, look for libraries in '/usr/lib32' first;
+  // for 64-bit hosts that's where they will live. We fall back to '/usr/lib'
+  // for the remaining cases.
+  if (Triple.getArch() == llvm::Triple::x86 ||
+      Triple.getArch() == llvm::Triple::ppc)
     getFilePaths().push_back("/usr/lib32");
-  } else {
-    getFilePaths().push_back("/usr/lib");
-  }
+
+  getFilePaths().push_back("/usr/lib");
 }
 
 Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,