]> granicus.if.org Git - clang/commitdiff
Driver/FreeBSD: Change how FreeBSD derives the Lib32 variable, to normalize tool
authorDaniel Dunbar <daniel@zuster.org>
Mon, 2 Aug 2010 05:43:59 +0000 (05:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 2 Aug 2010 05:43:59 +0000 (05:43 +0000)
chain construction.

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

lib/Driver/HostInfo.cpp
lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h

index a8fdec8a103ea3df3d2bd50ab3228a0ef6163995..60b969548285377e7d15d6df9e6ce0bc238636a6 100644 (file)
@@ -363,27 +363,18 @@ bool FreeBSDHostInfo::useDriverDriver() const {
 
 ToolChain *FreeBSDHostInfo::CreateToolChain(const ArgList &Args,
                                             const char *ArchName) const {
-  bool Lib32 = false;
-
   assert(!ArchName &&
          "Unexpected arch name on platform without driver driver support.");
 
-  // On x86_64 we need to be able to compile 32-bits binaries as well.
-  // Compiling 64-bit binaries on i386 is not supported. We don't have a
-  // lib64.
   std::string Arch = getArchName();
   ArchName = Arch.c_str();
-  if (Args.hasArg(options::OPT_m32) && getArchName() == "x86_64") {
-    ArchName = "i386";
-    Lib32 = true;
-  }
 
   ToolChain *&TC = ToolChains[ArchName];
   if (!TC) {
     llvm::Triple TCTriple(getTriple());
     TCTriple.setArchName(ArchName);
 
-    TC = new toolchains::FreeBSD(*this, TCTriple, Lib32);
+    TC = new toolchains::FreeBSD(*this, TCTriple);
   }
 
   return TC;
index bdccc3e3da29787fda84bd5c80730ca89d5a9a38..5a4ad6023c96e8754247b1efa3fef5821d88dca9 100644 (file)
@@ -889,8 +889,16 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
 
 /// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
 
-FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple, bool Lib32)
+FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple)
   : Generic_GCC(Host, Triple) {
+
+  // Determine if we are compiling 32-bit code on an x86_64 platform.
+  bool Lib32 = false;
+  if (Triple.getArch() == llvm::Triple::x86 &&
+      llvm::Triple(getDriver().DefaultHostTriple).getArch() ==
+        llvm::Triple::x86_64)
+    Lib32 = true;
+    
   getProgramPaths().push_back(getDriver().Dir + "/../libexec");
   getProgramPaths().push_back("/usr/libexec");
   if (Lib32) {
index 06d4fff4e7ccc91eb5471340bbe96977d82f41c1..dfc18fe2b2d462e310a8ed8734b3473ef2819849 100644 (file)
@@ -269,7 +269,7 @@ public:
 
 class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_GCC {
 public:
-  FreeBSD(const HostInfo &Host, const llvm::Triple& Triple, bool Lib32);
+  FreeBSD(const HostInfo &Host, const llvm::Triple& Triple);
 
   virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
 };