[cfe-commits] r148939 - /cfe/trunk/lib/Driver/ToolChains.cpp

Chandler Carruth chandlerc at gmail.com
Wed Jan 25 00:04:15 PST 2012


Author: chandlerc
Date: Wed Jan 25 02:04:15 2012
New Revision: 148939

URL: http://llvm.org/viewvc/llvm-project?rev=148939&view=rev
Log:
Switch FreeBSD to just include both '/usr/lib32' and '/usr/lib' in the
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.

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=148939&r1=148938&r2=148939&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jan 25 02:04:15 2012
@@ -1628,23 +1628,14 @@
 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,





More information about the cfe-commits mailing list