From: Chandler Carruth Date: Wed, 25 Jan 2012 08:04:15 +0000 (+0000) Subject: Switch FreeBSD to just include both '/usr/lib32' and '/usr/lib' in the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f75cc3365da11c3677d961bbb11d1e86e3d2fc2;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148939 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index ba0c2b431b..6b8168e686 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -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,