summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-17 21:38:00 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-17 21:38:00 +0000
commit83b08eb6d2a7f71328db51baa79c654bb9dcc55d (patch)
tree2bd0b4d9c9c642ee89c271369dd70228a3a6a2e7 /lib
parentbaf07759bc5ccd6f4cab62a2d7ea23321ced7492 (diff)
Driver: Stub out generic GCC tool chain implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Driver/HostInfo.cpp21
-rw-r--r--lib/Driver/ToolChains.h54
2 files changed, 66 insertions, 9 deletions
diff --git a/lib/Driver/HostInfo.cpp b/lib/Driver/HostInfo.cpp
index 9e8213876c..b98318dd26 100644
--- a/lib/Driver/HostInfo.cpp
+++ b/lib/Driver/HostInfo.cpp
@@ -17,6 +17,8 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Compiler.h"
+#include "ToolChains.h"
+
#include <cassert>
using namespace clang::driver;
@@ -96,15 +98,14 @@ ToolChain *DarwinHostInfo::getToolChain(const ArgList &Args,
ToolChain *&TC = ToolChains[ArchName];
if (!TC) {
- TC = 0;
-#if 0
- if (ArchName == "i386")
- TC = new Darwin_X86_ToolChain(ArchName);
- else if (ArchName == "x86_64")
- TC = new Darwin_X86_ToolChain(ArchName);
+ if (strcmp(ArchName, "i386") == 0 || strcmp(ArchName, "x86_64") == 0)
+ TC = new toolchains::Generic_GCC(*this, ArchName,
+ getPlatformName().c_str(),
+ getOSName().c_str());
else
- TC = new Darwin_GCC_ToolChain(ArchName);
-#endif
+ TC = new toolchains::Generic_GCC(*this, ArchName,
+ getPlatformName().c_str(),
+ getOSName().c_str());
}
return TC;
@@ -156,7 +157,9 @@ ToolChain *UnknownHostInfo::getToolChain(const ArgList &Args,
ToolChain *&TC = ToolChains[ArchName];
if (!TC)
- TC = 0; //new Generic_GCC_ToolChain(ArchName);
+ TC = new toolchains::Generic_GCC(*this, ArchName,
+ getPlatformName().c_str(),
+ getOSName().c_str());
return 0;
}
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
new file mode 100644
index 0000000000..a8360af359
--- /dev/null
+++ b/lib/Driver/ToolChains.h
@@ -0,0 +1,54 @@
+//===--- ToolChains.h - ToolChain Implementations ---------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_LIB_DRIVER_TOOLCHAINS_H_
+#define CLANG_LIB_DRIVER_TOOLCHAINS_H_
+
+#include "clang/Driver/ToolChain.h"
+
+#include "llvm/Support/Compiler.h"
+
+namespace clang {
+namespace driver {
+namespace toolchains VISIBILITY_HIDDEN {
+
+class Generic_GCC : public ToolChain {
+public:
+ Generic_GCC(const HostInfo &Host, const char *Arch, const char *Platform,
+ const char *OS) : ToolChain(Host, Arch, Platform, OS) {
+ }
+
+ virtual ArgList *TranslateArgs(ArgList &Args) const { return &Args; }
+
+ virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const {
+ return *((Tool*) 0);
+ }
+
+ virtual bool IsMathErrnoDefault() const { return true; }
+
+ virtual bool IsUnwindTablesDefault() const {
+ // FIXME: Gross; we should probably have some separate target definition,
+ // possibly even reusing the one in clang.
+ return getArchName() == "x86_64";
+ }
+
+ virtual const char *GetDefaultRelocationModel() const {
+ return "static";
+ }
+
+ virtual const char *GetForcedPicModel() const {
+ return 0;
+ }
+};
+
+} // end namespace toolchains
+} // end namespace driver
+} // end namespace clang
+
+#endif