2011-01-01 01:31:54 +08:00
|
|
|
//===--- ToolChains.cpp - ToolChain Implementations -----------------------===//
|
2009-03-20 08:20:03 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ToolChains.h"
|
|
|
|
|
2009-03-25 12:13:45 +08:00
|
|
|
#include "clang/Driver/Arg.h"
|
|
|
|
#include "clang/Driver/ArgList.h"
|
2010-05-21 05:48:38 +08:00
|
|
|
#include "clang/Driver/Compilation.h"
|
2009-03-24 00:15:50 +08:00
|
|
|
#include "clang/Driver/Driver.h"
|
2009-03-25 14:12:34 +08:00
|
|
|
#include "clang/Driver/DriverDiagnostic.h"
|
2009-03-24 00:15:50 +08:00
|
|
|
#include "clang/Driver/HostInfo.h"
|
2009-11-19 08:15:11 +08:00
|
|
|
#include "clang/Driver/OptTable.h"
|
2009-03-25 14:12:34 +08:00
|
|
|
#include "clang/Driver/Option.h"
|
2009-11-19 12:25:22 +08:00
|
|
|
#include "clang/Driver/Options.h"
|
2010-09-04 01:16:03 +08:00
|
|
|
#include "clang/Basic/Version.h"
|
2009-03-24 00:15:50 +08:00
|
|
|
|
2010-08-24 06:35:37 +08:00
|
|
|
#include "llvm/ADT/SmallString.h"
|
2009-03-24 00:15:50 +08:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2009-09-10 06:33:15 +08:00
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2011-01-10 10:34:13 +08:00
|
|
|
#include "llvm/Support/FileSystem.h"
|
2010-11-08 04:14:31 +08:00
|
|
|
#include "llvm/Support/MemoryBuffer.h"
|
2009-03-25 14:58:31 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2010-11-30 02:12:39 +08:00
|
|
|
#include "llvm/Support/Path.h"
|
2010-12-10 01:36:38 +08:00
|
|
|
#include "llvm/Support/system_error.h"
|
2009-03-24 00:15:50 +08:00
|
|
|
|
2009-04-11 05:00:07 +08:00
|
|
|
#include <cstdlib> // ::getenv
|
|
|
|
|
2009-03-20 08:20:03 +08:00
|
|
|
using namespace clang::driver;
|
|
|
|
using namespace clang::driver::toolchains;
|
|
|
|
|
2009-09-05 02:34:51 +08:00
|
|
|
/// Darwin - Darwin tool chain for i386 and x86_64.
|
2009-03-20 08:57:52 +08:00
|
|
|
|
2010-08-02 13:44:07 +08:00
|
|
|
Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple)
|
2010-01-27 08:56:44 +08:00
|
|
|
: ToolChain(Host, Triple), TargetInitialized(false)
|
2009-09-18 16:15:13 +08:00
|
|
|
{
|
2010-08-02 13:44:07 +08:00
|
|
|
// Compute the initial Darwin version based on the host.
|
|
|
|
bool HadExtra;
|
|
|
|
std::string OSName = Triple.getOSName();
|
2011-02-26 05:20:15 +08:00
|
|
|
if (!Driver::GetReleaseVersion(&OSName.c_str()[6],
|
2010-08-02 13:44:07 +08:00
|
|
|
DarwinVersion[0], DarwinVersion[1],
|
|
|
|
DarwinVersion[2], HadExtra))
|
|
|
|
getDriver().Diag(clang::diag::err_drv_invalid_darwin_version) << OSName;
|
|
|
|
|
2009-03-27 00:23:12 +08:00
|
|
|
llvm::raw_string_ostream(MacosxVersionMin)
|
2010-08-02 13:44:07 +08:00
|
|
|
<< "10." << std::max(0, (int)DarwinVersion[0] - 4) << '.'
|
|
|
|
<< DarwinVersion[1];
|
2009-09-18 16:15:13 +08:00
|
|
|
}
|
|
|
|
|
2010-08-02 13:43:56 +08:00
|
|
|
types::ID Darwin::LookupTypeForExtension(const char *Ext) const {
|
|
|
|
types::ID Ty = types::lookupTypeForExtension(Ext);
|
|
|
|
|
|
|
|
// Darwin always preprocesses assembly files (unless -x is used explicitly).
|
|
|
|
if (Ty == types::TY_PP_Asm)
|
|
|
|
return types::TY_Asm;
|
|
|
|
|
|
|
|
return Ty;
|
|
|
|
}
|
|
|
|
|
2010-09-17 08:24:52 +08:00
|
|
|
bool Darwin::HasNativeLLVMSupport() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-22 10:04:58 +08:00
|
|
|
// FIXME: Can we tablegen this?
|
|
|
|
static const char *GetArmArchForMArch(llvm::StringRef Value) {
|
|
|
|
if (Value == "armv6k")
|
|
|
|
return "armv6";
|
|
|
|
|
|
|
|
if (Value == "armv5tej")
|
|
|
|
return "armv5";
|
|
|
|
|
|
|
|
if (Value == "xscale")
|
|
|
|
return "xscale";
|
|
|
|
|
|
|
|
if (Value == "armv4t")
|
|
|
|
return "armv4t";
|
|
|
|
|
|
|
|
if (Value == "armv7" || Value == "armv7-a" || Value == "armv7-r" ||
|
|
|
|
Value == "armv7-m" || Value == "armv7a" || Value == "armv7r" ||
|
|
|
|
Value == "armv7m")
|
|
|
|
return "armv7";
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Can we tablegen this?
|
|
|
|
static const char *GetArmArchForMCpu(llvm::StringRef Value) {
|
|
|
|
if (Value == "arm10tdmi" || Value == "arm1020t" || Value == "arm9e" ||
|
|
|
|
Value == "arm946e-s" || Value == "arm966e-s" ||
|
|
|
|
Value == "arm968e-s" || Value == "arm10e" ||
|
|
|
|
Value == "arm1020e" || Value == "arm1022e" || Value == "arm926ej-s" ||
|
|
|
|
Value == "arm1026ej-s")
|
|
|
|
return "armv5";
|
|
|
|
|
|
|
|
if (Value == "xscale")
|
|
|
|
return "xscale";
|
|
|
|
|
|
|
|
if (Value == "arm1136j-s" || Value == "arm1136jf-s" ||
|
|
|
|
Value == "arm1176jz-s" || Value == "arm1176jzf-s")
|
|
|
|
return "armv6";
|
|
|
|
|
|
|
|
if (Value == "cortex-a8" || Value == "cortex-r4" || Value == "cortex-m3")
|
|
|
|
return "armv7";
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
llvm::StringRef Darwin::getDarwinArchName(const ArgList &Args) const {
|
|
|
|
switch (getTriple().getArch()) {
|
|
|
|
default:
|
|
|
|
return getArchName();
|
2011-03-07 03:11:49 +08:00
|
|
|
|
|
|
|
case llvm::Triple::thumb:
|
2010-01-22 10:04:58 +08:00
|
|
|
case llvm::Triple::arm: {
|
|
|
|
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
|
|
|
|
if (const char *Arch = GetArmArchForMArch(A->getValue(Args)))
|
|
|
|
return Arch;
|
|
|
|
|
|
|
|
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
|
|
|
|
if (const char *Arch = GetArmArchForMCpu(A->getValue(Args)))
|
|
|
|
return Arch;
|
|
|
|
|
|
|
|
return "arm";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-05 02:34:51 +08:00
|
|
|
Darwin::~Darwin() {
|
2009-03-20 08:57:52 +08:00
|
|
|
// Free tool implementations.
|
|
|
|
for (llvm::DenseMap<unsigned, Tool*>::iterator
|
|
|
|
it = Tools.begin(), ie = Tools.end(); it != ie; ++it)
|
|
|
|
delete it->second;
|
|
|
|
}
|
|
|
|
|
2010-08-24 06:35:37 +08:00
|
|
|
std::string Darwin::ComputeEffectiveClangTriple(const ArgList &Args) const {
|
|
|
|
llvm::Triple Triple(ComputeLLVMTriple(Args));
|
|
|
|
|
|
|
|
// If the target isn't initialized (e.g., an unknown Darwin platform, return
|
|
|
|
// the default triple).
|
|
|
|
if (!isTargetInitialized())
|
|
|
|
return Triple.getTriple();
|
|
|
|
|
|
|
|
unsigned Version[3];
|
|
|
|
getTargetVersion(Version);
|
|
|
|
|
|
|
|
// Mangle the target version into the OS triple component. For historical
|
|
|
|
// reasons that make little sense, the version passed here is the "darwin"
|
|
|
|
// version, which drops the 10 and offsets by 4. See inverse code when
|
|
|
|
// setting the OS version preprocessor define.
|
|
|
|
if (!isTargetIPhoneOS()) {
|
|
|
|
Version[0] = Version[1] + 4;
|
|
|
|
Version[1] = Version[2];
|
|
|
|
Version[2] = 0;
|
|
|
|
} else {
|
|
|
|
// Use the environment to communicate that we are targetting iPhoneOS.
|
|
|
|
Triple.setEnvironmentName("iphoneos");
|
|
|
|
}
|
|
|
|
|
|
|
|
llvm::SmallString<16> Str;
|
|
|
|
llvm::raw_svector_ostream(Str) << "darwin" << Version[0]
|
|
|
|
<< "." << Version[1] << "." << Version[2];
|
|
|
|
Triple.setOSName(Str.str());
|
|
|
|
|
|
|
|
return Triple.getTriple();
|
|
|
|
}
|
|
|
|
|
2009-09-05 02:34:51 +08:00
|
|
|
Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const {
|
2009-03-20 08:57:52 +08:00
|
|
|
Action::ActionClass Key;
|
2009-12-22 02:54:17 +08:00
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
2009-03-20 08:57:52 +08:00
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
2010-05-21 05:48:38 +08:00
|
|
|
// FIXME: This doesn't belong here, but ideally we will support static soon
|
|
|
|
// anyway.
|
|
|
|
bool HasStatic = (C.getArgs().hasArg(options::OPT_mkernel) ||
|
|
|
|
C.getArgs().hasArg(options::OPT_static) ||
|
|
|
|
C.getArgs().hasArg(options::OPT_fapple_kext));
|
|
|
|
bool IsIADefault = IsIntegratedAssemblerDefault() && !HasStatic;
|
|
|
|
bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
|
|
|
|
options::OPT_no_integrated_as,
|
|
|
|
IsIADefault);
|
|
|
|
|
2009-03-20 08:57:52 +08:00
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::InputClass:
|
|
|
|
case Action::BindArchClass:
|
|
|
|
assert(0 && "Invalid tool kind.");
|
|
|
|
case Action::PreprocessJobClass:
|
2009-03-30 06:27:40 +08:00
|
|
|
T = new tools::darwin::Preprocess(*this); break;
|
2009-03-20 08:57:52 +08:00
|
|
|
case Action::AnalyzeJobClass:
|
|
|
|
T = new tools::Clang(*this); break;
|
2009-03-30 06:27:40 +08:00
|
|
|
case Action::PrecompileJobClass:
|
2009-03-20 08:57:52 +08:00
|
|
|
case Action::CompileJobClass:
|
2009-03-30 06:27:40 +08:00
|
|
|
T = new tools::darwin::Compile(*this); break;
|
2010-05-21 05:48:38 +08:00
|
|
|
case Action::AssembleJobClass: {
|
|
|
|
if (UseIntegratedAs)
|
|
|
|
T = new tools::ClangAs(*this);
|
|
|
|
else
|
|
|
|
T = new tools::darwin::Assemble(*this);
|
|
|
|
break;
|
|
|
|
}
|
2009-03-20 08:57:52 +08:00
|
|
|
case Action::LinkJobClass:
|
2009-09-05 01:39:02 +08:00
|
|
|
T = new tools::darwin::Link(*this); break;
|
2009-03-20 08:57:52 +08:00
|
|
|
case Action::LipoJobClass:
|
|
|
|
T = new tools::darwin::Lipo(*this); break;
|
2010-06-05 02:28:36 +08:00
|
|
|
case Action::DsymutilJobClass:
|
|
|
|
T = new tools::darwin::Dsymutil(*this); break;
|
2009-03-20 08:57:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
2009-09-18 16:15:03 +08:00
|
|
|
|
2010-08-02 13:44:07 +08:00
|
|
|
DarwinClang::DarwinClang(const HostInfo &Host, const llvm::Triple& Triple)
|
|
|
|
: Darwin(Host, Triple)
|
2009-09-18 16:15:13 +08:00
|
|
|
{
|
2010-09-17 16:22:12 +08:00
|
|
|
getProgramPaths().push_back(getDriver().getInstalledDir());
|
|
|
|
if (getDriver().getInstalledDir() != getDriver().Dir)
|
|
|
|
getProgramPaths().push_back(getDriver().Dir);
|
|
|
|
|
2009-09-18 16:15:13 +08:00
|
|
|
// We expect 'as', 'ld', etc. to be adjacent to our install dir.
|
2010-08-02 06:29:51 +08:00
|
|
|
getProgramPaths().push_back(getDriver().getInstalledDir());
|
|
|
|
if (getDriver().getInstalledDir() != getDriver().Dir)
|
|
|
|
getProgramPaths().push_back(getDriver().Dir);
|
2010-09-17 16:22:12 +08:00
|
|
|
|
|
|
|
// For fallback, we need to know how to find the GCC cc1 executables, so we
|
|
|
|
// also add the GCC libexec paths. This is legiy code that can be removed once
|
|
|
|
// fallback is no longer useful.
|
|
|
|
std::string ToolChainDir = "i686-apple-darwin";
|
|
|
|
ToolChainDir += llvm::utostr(DarwinVersion[0]);
|
|
|
|
ToolChainDir += "/4.2.1";
|
|
|
|
|
|
|
|
std::string Path = getDriver().Dir;
|
|
|
|
Path += "/../libexec/gcc/";
|
|
|
|
Path += ToolChainDir;
|
|
|
|
getProgramPaths().push_back(Path);
|
|
|
|
|
|
|
|
Path = "/usr/libexec/gcc/";
|
|
|
|
Path += ToolChainDir;
|
|
|
|
getProgramPaths().push_back(Path);
|
2009-09-18 16:15:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void DarwinClang::AddLinkSearchPathArgs(const ArgList &Args,
|
|
|
|
ArgStringList &CmdArgs) const {
|
|
|
|
// The Clang toolchain uses explicit paths for internal libraries.
|
2010-07-01 07:56:13 +08:00
|
|
|
|
|
|
|
// Unfortunately, we still might depend on a few of the libraries that are
|
|
|
|
// only available in the gcc library directory (in particular
|
|
|
|
// libstdc++.dylib). For now, hardcode the path to the known install location.
|
|
|
|
llvm::sys::Path P(getDriver().Dir);
|
|
|
|
P.eraseComponent(); // .../usr/bin -> ../usr
|
|
|
|
P.appendComponent("lib");
|
|
|
|
P.appendComponent("gcc");
|
|
|
|
switch (getTriple().getArch()) {
|
|
|
|
default:
|
|
|
|
assert(0 && "Invalid Darwin arch!");
|
|
|
|
case llvm::Triple::x86:
|
|
|
|
case llvm::Triple::x86_64:
|
|
|
|
P.appendComponent("i686-apple-darwin10");
|
|
|
|
break;
|
|
|
|
case llvm::Triple::arm:
|
|
|
|
case llvm::Triple::thumb:
|
|
|
|
P.appendComponent("arm-apple-darwin10");
|
|
|
|
break;
|
|
|
|
case llvm::Triple::ppc:
|
|
|
|
case llvm::Triple::ppc64:
|
|
|
|
P.appendComponent("powerpc-apple-darwin10");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
P.appendComponent("4.2.1");
|
2010-08-24 04:58:52 +08:00
|
|
|
|
|
|
|
// Determine the arch specific GCC subdirectory.
|
|
|
|
const char *ArchSpecificDir = 0;
|
|
|
|
switch (getTriple().getArch()) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
case llvm::Triple::arm:
|
2010-08-26 08:55:52 +08:00
|
|
|
case llvm::Triple::thumb: {
|
|
|
|
std::string Triple = ComputeLLVMTriple(Args);
|
|
|
|
llvm::StringRef TripleStr = Triple;
|
|
|
|
if (TripleStr.startswith("armv5") || TripleStr.startswith("thumbv5"))
|
|
|
|
ArchSpecificDir = "v5";
|
|
|
|
else if (TripleStr.startswith("armv6") || TripleStr.startswith("thumbv6"))
|
|
|
|
ArchSpecificDir = "v6";
|
|
|
|
else if (TripleStr.startswith("armv7") || TripleStr.startswith("thumbv7"))
|
|
|
|
ArchSpecificDir = "v7";
|
2010-08-24 04:58:52 +08:00
|
|
|
break;
|
2010-08-26 08:55:52 +08:00
|
|
|
}
|
2010-08-24 04:58:52 +08:00
|
|
|
case llvm::Triple::ppc64:
|
|
|
|
ArchSpecificDir = "ppc64";
|
|
|
|
break;
|
|
|
|
case llvm::Triple::x86_64:
|
|
|
|
ArchSpecificDir = "x86_64";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ArchSpecificDir) {
|
|
|
|
P.appendComponent(ArchSpecificDir);
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
|
|
|
if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
|
2010-08-24 04:58:52 +08:00
|
|
|
CmdArgs.push_back(Args.MakeArgString("-L" + P.str()));
|
|
|
|
P.eraseComponent();
|
|
|
|
}
|
|
|
|
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
|
|
|
if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
|
2010-07-01 07:56:13 +08:00
|
|
|
CmdArgs.push_back(Args.MakeArgString("-L" + P.str()));
|
2009-09-18 16:15:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
|
|
|
ArgStringList &CmdArgs) const {
|
2010-01-22 11:38:14 +08:00
|
|
|
// Darwin doesn't support real static executables, don't link any runtime
|
|
|
|
// libraries with -static.
|
|
|
|
if (Args.hasArg(options::OPT_static))
|
2009-09-18 16:15:13 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Reject -static-libgcc for now, we can deal with this when and if someone
|
|
|
|
// cares. This is useful in situations where someone wants to statically link
|
|
|
|
// something like libstdc++, and needs its runtime support routines.
|
|
|
|
if (const Arg *A = Args.getLastArg(options::OPT_static_libgcc)) {
|
2009-12-22 02:54:17 +08:00
|
|
|
getDriver().Diag(clang::diag::err_drv_unsupported_opt)
|
2009-09-18 16:15:13 +08:00
|
|
|
<< A->getAsString(Args);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-01-22 11:38:14 +08:00
|
|
|
// Otherwise link libSystem, then the dynamic runtime library, and finally any
|
|
|
|
// target specific static runtime library.
|
2009-09-18 16:15:13 +08:00
|
|
|
CmdArgs.push_back("-lSystem");
|
2010-01-22 11:38:14 +08:00
|
|
|
|
|
|
|
// Select the dynamic runtime library and the target specific static library.
|
|
|
|
const char *DarwinStaticLib = 0;
|
2010-01-27 08:56:37 +08:00
|
|
|
if (isTargetIPhoneOS()) {
|
2010-01-22 11:38:14 +08:00
|
|
|
CmdArgs.push_back("-lgcc_s.1");
|
|
|
|
|
|
|
|
// We may need some static functions for armv6/thumb which are required to
|
|
|
|
// be in the same linkage unit as their caller.
|
|
|
|
if (getDarwinArchName(Args) == "armv6")
|
|
|
|
DarwinStaticLib = "libclang_rt.armv6.a";
|
|
|
|
} else {
|
|
|
|
// The dynamic runtime library was merged with libSystem for 10.6 and
|
|
|
|
// beyond; only 10.4 and 10.5 need an additional runtime library.
|
2010-01-27 08:57:03 +08:00
|
|
|
if (isMacosxVersionLT(10, 5))
|
2010-01-22 11:38:14 +08:00
|
|
|
CmdArgs.push_back("-lgcc_s.10.4");
|
2010-01-27 08:57:03 +08:00
|
|
|
else if (isMacosxVersionLT(10, 6))
|
2010-01-22 11:38:14 +08:00
|
|
|
CmdArgs.push_back("-lgcc_s.10.5");
|
|
|
|
|
2010-09-22 08:03:52 +08:00
|
|
|
// For OS X, we thought we would only need a static runtime library when
|
|
|
|
// targetting 10.4, to provide versions of the static functions which were
|
|
|
|
// omitted from 10.4.dylib.
|
|
|
|
//
|
|
|
|
// Unfortunately, that turned out to not be true, because Darwin system
|
|
|
|
// headers can still use eprintf on i386, and it is not exported from
|
|
|
|
// libSystem. Therefore, we still must provide a runtime library just for
|
|
|
|
// the tiny tiny handful of projects that *might* use that symbol.
|
|
|
|
if (isMacosxVersionLT(10, 5)) {
|
2010-01-22 11:38:14 +08:00
|
|
|
DarwinStaticLib = "libclang_rt.10.4.a";
|
2010-09-22 08:03:52 +08:00
|
|
|
} else {
|
|
|
|
if (getTriple().getArch() == llvm::Triple::x86)
|
|
|
|
DarwinStaticLib = "libclang_rt.eprintf.a";
|
|
|
|
}
|
2010-01-22 11:38:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Add the target specific static library, if needed.
|
|
|
|
if (DarwinStaticLib) {
|
|
|
|
llvm::sys::Path P(getDriver().ResourceDir);
|
|
|
|
P.appendComponent("lib");
|
|
|
|
P.appendComponent("darwin");
|
|
|
|
P.appendComponent(DarwinStaticLib);
|
|
|
|
|
|
|
|
// For now, allow missing resource libraries to support developers who may
|
|
|
|
// not have compiler-rt checked out or integrated into their build.
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
|
|
|
if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
|
2010-01-22 11:38:14 +08:00
|
|
|
CmdArgs.push_back(Args.MakeArgString(P.str()));
|
|
|
|
}
|
2009-09-18 16:15:13 +08:00
|
|
|
}
|
|
|
|
|
2010-07-20 01:11:36 +08:00
|
|
|
void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
|
2009-12-22 02:54:17 +08:00
|
|
|
const OptTable &Opts = getDriver().getOpts();
|
2009-03-25 14:58:31 +08:00
|
|
|
|
2010-01-27 08:56:25 +08:00
|
|
|
Arg *OSXVersion = Args.getLastArg(options::OPT_mmacosx_version_min_EQ);
|
|
|
|
Arg *iPhoneVersion = Args.getLastArg(options::OPT_miphoneos_version_min_EQ);
|
2009-04-11 04:11:50 +08:00
|
|
|
if (OSXVersion && iPhoneVersion) {
|
2009-12-22 02:54:17 +08:00
|
|
|
getDriver().Diag(clang::diag::err_drv_argument_not_allowed_with)
|
2009-04-11 04:11:50 +08:00
|
|
|
<< OSXVersion->getAsString(Args)
|
2009-09-09 23:08:12 +08:00
|
|
|
<< iPhoneVersion->getAsString(Args);
|
2010-01-27 08:56:25 +08:00
|
|
|
iPhoneVersion = 0;
|
2009-04-11 04:11:50 +08:00
|
|
|
} else if (!OSXVersion && !iPhoneVersion) {
|
2010-01-26 09:45:19 +08:00
|
|
|
// If neither OS X nor iPhoneOS targets were specified, check for
|
|
|
|
// environment defines.
|
|
|
|
const char *OSXTarget = ::getenv("MACOSX_DEPLOYMENT_TARGET");
|
|
|
|
const char *iPhoneOSTarget = ::getenv("IPHONEOS_DEPLOYMENT_TARGET");
|
|
|
|
|
|
|
|
// Ignore empty strings.
|
|
|
|
if (OSXTarget && OSXTarget[0] == '\0')
|
|
|
|
OSXTarget = 0;
|
|
|
|
if (iPhoneOSTarget && iPhoneOSTarget[0] == '\0')
|
|
|
|
iPhoneOSTarget = 0;
|
|
|
|
|
2010-02-03 01:31:12 +08:00
|
|
|
// Diagnose conflicting deployment targets, and choose default platform
|
|
|
|
// based on the tool chain.
|
|
|
|
//
|
|
|
|
// FIXME: Don't hardcode default here.
|
|
|
|
if (OSXTarget && iPhoneOSTarget) {
|
|
|
|
// FIXME: We should see if we can get away with warning or erroring on
|
|
|
|
// this. Perhaps put under -pedantic?
|
|
|
|
if (getTriple().getArch() == llvm::Triple::arm ||
|
|
|
|
getTriple().getArch() == llvm::Triple::thumb)
|
2010-03-20 16:47:42 +08:00
|
|
|
OSXTarget = 0;
|
2010-02-03 01:31:12 +08:00
|
|
|
else
|
2010-03-20 16:47:42 +08:00
|
|
|
iPhoneOSTarget = 0;
|
2010-02-03 01:31:12 +08:00
|
|
|
}
|
2010-01-30 01:02:25 +08:00
|
|
|
|
2010-02-03 01:31:12 +08:00
|
|
|
if (OSXTarget) {
|
2009-09-05 02:35:21 +08:00
|
|
|
const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);
|
2010-07-20 01:11:36 +08:00
|
|
|
OSXVersion = Args.MakeJoinedArg(0, O, OSXTarget);
|
|
|
|
Args.append(OSXVersion);
|
2010-01-26 09:45:19 +08:00
|
|
|
} else if (iPhoneOSTarget) {
|
2009-09-05 02:35:21 +08:00
|
|
|
const Option *O = Opts.getOption(options::OPT_miphoneos_version_min_EQ);
|
2010-07-20 01:11:36 +08:00
|
|
|
iPhoneVersion = Args.MakeJoinedArg(0, O, iPhoneOSTarget);
|
|
|
|
Args.append(iPhoneVersion);
|
2010-01-26 09:45:19 +08:00
|
|
|
} else {
|
2010-07-16 00:18:06 +08:00
|
|
|
// Otherwise, assume we are targeting OS X.
|
|
|
|
const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);
|
2010-07-20 01:11:36 +08:00
|
|
|
OSXVersion = Args.MakeJoinedArg(0, O, MacosxVersionMin);
|
|
|
|
Args.append(OSXVersion);
|
2009-09-05 02:35:21 +08:00
|
|
|
}
|
2009-03-25 14:58:31 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2010-01-27 08:56:25 +08:00
|
|
|
// Set the tool chain target information.
|
|
|
|
unsigned Major, Minor, Micro;
|
|
|
|
bool HadExtra;
|
|
|
|
if (OSXVersion) {
|
|
|
|
assert(!iPhoneVersion && "Unknown target platform!");
|
|
|
|
if (!Driver::GetReleaseVersion(OSXVersion->getValue(Args), Major, Minor,
|
|
|
|
Micro, HadExtra) || HadExtra ||
|
|
|
|
Major != 10 || Minor >= 10 || Micro >= 10)
|
|
|
|
getDriver().Diag(clang::diag::err_drv_invalid_version_number)
|
|
|
|
<< OSXVersion->getAsString(Args);
|
|
|
|
} else {
|
|
|
|
assert(iPhoneVersion && "Unknown target platform!");
|
|
|
|
if (!Driver::GetReleaseVersion(iPhoneVersion->getValue(Args), Major, Minor,
|
|
|
|
Micro, HadExtra) || HadExtra ||
|
|
|
|
Major >= 10 || Minor >= 100 || Micro >= 100)
|
|
|
|
getDriver().Diag(clang::diag::err_drv_invalid_version_number)
|
|
|
|
<< iPhoneVersion->getAsString(Args);
|
|
|
|
}
|
|
|
|
setTarget(iPhoneVersion, Major, Minor, Micro);
|
2010-07-20 01:11:33 +08:00
|
|
|
}
|
|
|
|
|
2010-09-17 09:20:05 +08:00
|
|
|
void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
|
2010-09-17 09:16:06 +08:00
|
|
|
ArgStringList &CmdArgs) const {
|
|
|
|
CXXStdlibType Type = GetCXXStdlibType(Args);
|
|
|
|
|
|
|
|
switch (Type) {
|
|
|
|
case ToolChain::CST_Libcxx:
|
|
|
|
CmdArgs.push_back("-lc++");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ToolChain::CST_Libstdcxx: {
|
|
|
|
// Unfortunately, -lstdc++ doesn't always exist in the standard search path;
|
|
|
|
// it was previously found in the gcc lib dir. However, for all the Darwin
|
|
|
|
// platforms we care about it was -lstdc++.6, so we search for that
|
|
|
|
// explicitly if we can't see an obvious -lstdc++ candidate.
|
|
|
|
|
|
|
|
// Check in the sysroot first.
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
2010-09-17 09:16:06 +08:00
|
|
|
if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
|
|
|
|
llvm::sys::Path P(A->getValue(Args));
|
|
|
|
P.appendComponent("usr");
|
|
|
|
P.appendComponent("lib");
|
|
|
|
P.appendComponent("libstdc++.dylib");
|
|
|
|
|
2011-01-10 10:34:13 +08:00
|
|
|
if (llvm::sys::fs::exists(P.str(), Exists) || !Exists) {
|
2010-09-17 09:16:06 +08:00
|
|
|
P.eraseComponent();
|
|
|
|
P.appendComponent("libstdc++.6.dylib");
|
2011-01-10 10:34:13 +08:00
|
|
|
if (!llvm::sys::fs::exists(P.str(), Exists) && Exists) {
|
2010-09-17 09:16:06 +08:00
|
|
|
CmdArgs.push_back(Args.MakeArgString(P.str()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, look in the root.
|
2011-01-10 10:34:13 +08:00
|
|
|
if ((llvm::sys::fs::exists("/usr/lib/libstdc++.dylib", Exists) || !Exists)&&
|
|
|
|
(!llvm::sys::fs::exists("/usr/lib/libstdc++.6.dylib", Exists) && Exists)){
|
2010-09-17 09:16:06 +08:00
|
|
|
CmdArgs.push_back("/usr/lib/libstdc++.6.dylib");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, let the linker search.
|
|
|
|
CmdArgs.push_back("-lstdc++");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-18 02:39:08 +08:00
|
|
|
void DarwinClang::AddCCKextLibArgs(const ArgList &Args,
|
|
|
|
ArgStringList &CmdArgs) const {
|
|
|
|
|
|
|
|
// For Darwin platforms, use the compiler-rt-based support library
|
|
|
|
// instead of the gcc-provided one (which is also incidentally
|
|
|
|
// only present in the gcc lib dir, which makes it hard to find).
|
|
|
|
|
|
|
|
llvm::sys::Path P(getDriver().ResourceDir);
|
|
|
|
P.appendComponent("lib");
|
|
|
|
P.appendComponent("darwin");
|
|
|
|
P.appendComponent("libclang_rt.cc_kext.a");
|
|
|
|
|
|
|
|
// For now, allow missing resource libraries to support developers who may
|
|
|
|
// not have compiler-rt checked out or integrated into their build.
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
|
|
|
if (!llvm::sys::fs::exists(P.str(), Exists) && Exists)
|
2010-09-18 02:39:08 +08:00
|
|
|
CmdArgs.push_back(Args.MakeArgString(P.str()));
|
|
|
|
}
|
|
|
|
|
2010-07-20 01:11:33 +08:00
|
|
|
DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
|
|
|
|
const char *BoundArch) const {
|
|
|
|
DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
|
|
|
|
const OptTable &Opts = getDriver().getOpts();
|
|
|
|
|
|
|
|
// FIXME: We really want to get out of the tool chain level argument
|
|
|
|
// translation business, as it makes the driver functionality much
|
|
|
|
// more opaque. For now, we follow gcc closely solely for the
|
|
|
|
// purpose of easily achieving feature parity & testability. Once we
|
|
|
|
// have something that works, we should reevaluate each translation
|
|
|
|
// and try to push it down into tool specific logic.
|
2010-01-27 08:56:25 +08:00
|
|
|
|
2010-06-12 06:00:26 +08:00
|
|
|
for (ArgList::const_iterator it = Args.begin(),
|
|
|
|
ie = Args.end(); it != ie; ++it) {
|
2009-03-25 14:12:34 +08:00
|
|
|
Arg *A = *it;
|
|
|
|
|
|
|
|
if (A->getOption().matches(options::OPT_Xarch__)) {
|
|
|
|
// FIXME: Canonicalize name.
|
|
|
|
if (getArchName() != A->getValue(Args, 0))
|
|
|
|
continue;
|
|
|
|
|
2011-02-19 13:33:51 +08:00
|
|
|
Arg *OriginalArg = A;
|
2010-06-15 05:23:08 +08:00
|
|
|
unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(Args, 1));
|
|
|
|
unsigned Prev = Index;
|
2009-03-25 14:58:31 +08:00
|
|
|
Arg *XarchArg = Opts.ParseOneArg(Args, Index);
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-03-25 14:12:34 +08:00
|
|
|
// If the argument parsing failed or more than one argument was
|
|
|
|
// consumed, the -Xarch_ argument's parameter tried to consume
|
|
|
|
// extra arguments. Emit an error and ignore.
|
|
|
|
//
|
|
|
|
// We also want to disallow any options which would alter the
|
|
|
|
// driver behavior; that isn't going to work in our model. We
|
|
|
|
// use isDriverOption() as an approximation, although things
|
|
|
|
// like -O4 are going to slip through.
|
2009-09-09 23:08:12 +08:00
|
|
|
if (!XarchArg || Index > Prev + 1 ||
|
2009-03-25 14:12:34 +08:00
|
|
|
XarchArg->getOption().isDriverOption()) {
|
2009-12-22 02:54:17 +08:00
|
|
|
getDriver().Diag(clang::diag::err_drv_invalid_Xarch_argument)
|
2009-03-25 14:12:34 +08:00
|
|
|
<< A->getAsString(Args);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-03-30 06:29:05 +08:00
|
|
|
XarchArg->setBaseArg(A);
|
2009-03-25 14:12:34 +08:00
|
|
|
A = XarchArg;
|
2010-06-15 05:23:08 +08:00
|
|
|
|
|
|
|
DAL->AddSynthesizedArg(A);
|
2011-02-19 13:33:51 +08:00
|
|
|
|
|
|
|
// Linker input arguments require custom handling. The problem is that we
|
|
|
|
// have already constructed the phase actions, so we can not treat them as
|
|
|
|
// "input arguments".
|
|
|
|
if (A->getOption().isLinkerInput()) {
|
|
|
|
// Convert the argument into individual Zlinker_input_args.
|
|
|
|
for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) {
|
|
|
|
DAL->AddSeparateArg(OriginalArg,
|
|
|
|
Opts.getOption(options::OPT_Zlinker_input),
|
|
|
|
A->getValue(Args, i));
|
|
|
|
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
}
|
2009-03-25 14:12:34 +08:00
|
|
|
|
2009-03-25 14:58:31 +08:00
|
|
|
// Sob. These is strictly gcc compatible for the time being. Apple
|
|
|
|
// gcc translates options twice, which means that self-expanding
|
|
|
|
// options add duplicates.
|
2009-11-19 12:14:53 +08:00
|
|
|
switch ((options::ID) A->getOption().getID()) {
|
2009-03-25 14:58:31 +08:00
|
|
|
default:
|
|
|
|
DAL->append(A);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_mkernel:
|
|
|
|
case options::OPT_fapple_kext:
|
|
|
|
DAL->append(A);
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_static));
|
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_static));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-03-25 14:58:31 +08:00
|
|
|
case options::OPT_dependency_file:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddSeparateArg(A, Opts.getOption(options::OPT_MF),
|
|
|
|
A->getValue(Args));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_gfull:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_g_Flag));
|
|
|
|
DAL->AddFlagArg(A,
|
|
|
|
Opts.getOption(options::OPT_fno_eliminate_unused_debug_symbols));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_gused:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_g_Flag));
|
|
|
|
DAL->AddFlagArg(A,
|
|
|
|
Opts.getOption(options::OPT_feliminate_unused_debug_symbols));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_fterminated_vtables:
|
|
|
|
case options::OPT_findirect_virtual_calls:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_fapple_kext));
|
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_static));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_shared:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_dynamiclib));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_fconstant_cfstrings:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_mconstant_cfstrings));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_fno_constant_cfstrings:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_mno_constant_cfstrings));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_Wnonportable_cfstrings:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A,
|
|
|
|
Opts.getOption(options::OPT_mwarn_nonportable_cfstrings));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_Wno_nonportable_cfstrings:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A,
|
|
|
|
Opts.getOption(options::OPT_mno_warn_nonportable_cfstrings));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_fpascal_strings:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_mpascal_strings));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case options::OPT_fno_pascal_strings:
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(A, Opts.getOption(options::OPT_mno_pascal_strings));
|
2009-03-25 14:58:31 +08:00
|
|
|
break;
|
|
|
|
}
|
2009-03-25 14:12:34 +08:00
|
|
|
}
|
|
|
|
|
2009-09-10 06:33:15 +08:00
|
|
|
if (getTriple().getArch() == llvm::Triple::x86 ||
|
|
|
|
getTriple().getArch() == llvm::Triple::x86_64)
|
2009-11-19 12:00:53 +08:00
|
|
|
if (!Args.hasArgNoClaim(options::OPT_mtune_EQ))
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, Opts.getOption(options::OPT_mtune_EQ), "core2");
|
2009-09-10 06:33:15 +08:00
|
|
|
|
|
|
|
// Add the arch options based on the particular spelling of -arch, to match
|
|
|
|
// how the driver driver works.
|
|
|
|
if (BoundArch) {
|
|
|
|
llvm::StringRef Name = BoundArch;
|
|
|
|
const Option *MCpu = Opts.getOption(options::OPT_mcpu_EQ);
|
|
|
|
const Option *MArch = Opts.getOption(options::OPT_march_EQ);
|
|
|
|
|
|
|
|
// This code must be kept in sync with LLVM's getArchTypeForDarwinArch,
|
|
|
|
// which defines the list of which architectures we accept.
|
|
|
|
if (Name == "ppc")
|
|
|
|
;
|
|
|
|
else if (Name == "ppc601")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "601");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "ppc603")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "603");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "ppc604")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "604");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "ppc604e")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "604e");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "ppc750")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "750");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "ppc7400")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "7400");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "ppc7450")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "7450");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "ppc970")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MCpu, "970");
|
2009-09-10 06:33:15 +08:00
|
|
|
|
|
|
|
else if (Name == "ppc64")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(0, Opts.getOption(options::OPT_m64));
|
2009-09-10 06:33:15 +08:00
|
|
|
|
|
|
|
else if (Name == "i386")
|
|
|
|
;
|
|
|
|
else if (Name == "i486")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "i486");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "i586")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "i586");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "i686")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "i686");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "pentium")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "pentium");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "pentium2")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "pentium2");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "pentpro")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "pentiumpro");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "pentIIm3")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "pentium2");
|
2009-09-10 06:33:15 +08:00
|
|
|
|
|
|
|
else if (Name == "x86_64")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddFlagArg(0, Opts.getOption(options::OPT_m64));
|
2009-03-25 14:58:31 +08:00
|
|
|
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "arm")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "armv4t");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "armv4t")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "armv4t");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "armv5")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "armv5tej");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "xscale")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "xscale");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "armv6")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "armv6k");
|
2009-09-10 06:33:15 +08:00
|
|
|
else if (Name == "armv7")
|
2010-06-15 04:20:41 +08:00
|
|
|
DAL->AddJoinedArg(0, MArch, "armv7a");
|
2009-09-10 06:33:15 +08:00
|
|
|
|
|
|
|
else
|
2009-12-12 13:05:38 +08:00
|
|
|
llvm_unreachable("invalid Darwin arch");
|
2009-09-10 06:33:15 +08:00
|
|
|
}
|
2009-03-25 14:58:31 +08:00
|
|
|
|
2010-07-20 01:11:36 +08:00
|
|
|
// Add an explicit version min argument for the deployment target. We do this
|
|
|
|
// after argument translation because -Xarch_ arguments may add a version min
|
|
|
|
// argument.
|
|
|
|
AddDeploymentTarget(*DAL);
|
|
|
|
|
2009-03-25 14:12:34 +08:00
|
|
|
return DAL;
|
2009-09-09 23:08:12 +08:00
|
|
|
}
|
2009-03-20 08:57:52 +08:00
|
|
|
|
2009-09-05 02:34:51 +08:00
|
|
|
bool Darwin::IsUnwindTablesDefault() const {
|
2009-03-20 08:57:52 +08:00
|
|
|
// FIXME: Gross; we should probably have some separate target
|
|
|
|
// definition, possibly even reusing the one in clang.
|
|
|
|
return getArchName() == "x86_64";
|
|
|
|
}
|
|
|
|
|
2009-12-18 10:43:17 +08:00
|
|
|
bool Darwin::UseDwarfDebugFlags() const {
|
|
|
|
if (const char *S = ::getenv("RC_DEBUG_OPTIONS"))
|
|
|
|
return S[0] != '\0';
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-02-11 02:49:11 +08:00
|
|
|
bool Darwin::UseSjLjExceptions() const {
|
|
|
|
// Darwin uses SjLj exceptions on ARM.
|
|
|
|
return (getTriple().getArch() == llvm::Triple::arm ||
|
|
|
|
getTriple().getArch() == llvm::Triple::thumb);
|
|
|
|
}
|
|
|
|
|
2009-09-05 02:34:51 +08:00
|
|
|
const char *Darwin::GetDefaultRelocationModel() const {
|
2009-03-20 08:57:52 +08:00
|
|
|
return "pic";
|
|
|
|
}
|
|
|
|
|
2009-09-05 02:34:51 +08:00
|
|
|
const char *Darwin::GetForcedPicModel() const {
|
2009-03-20 08:57:52 +08:00
|
|
|
if (getArchName() == "x86_64")
|
|
|
|
return "pic";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-02 02:49:30 +08:00
|
|
|
bool Darwin::SupportsProfiling() const {
|
|
|
|
// Profiling instrumentation is only supported on x86.
|
|
|
|
return getArchName() == "i386" || getArchName() == "x86_64";
|
|
|
|
}
|
|
|
|
|
2010-04-11 00:20:23 +08:00
|
|
|
bool Darwin::SupportsObjCGC() const {
|
|
|
|
// Garbage collection is supported everywhere except on iPhone OS.
|
|
|
|
return !isTargetIPhoneOS();
|
|
|
|
}
|
|
|
|
|
2010-08-24 06:35:37 +08:00
|
|
|
std::string
|
|
|
|
Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args) const {
|
|
|
|
return ComputeLLVMTriple(Args);
|
|
|
|
}
|
|
|
|
|
2009-03-20 08:20:03 +08:00
|
|
|
/// Generic_GCC - A tool chain using the 'gcc' command to perform
|
|
|
|
/// all subcommands; this relies on gcc translating the majority of
|
|
|
|
/// command line options.
|
|
|
|
|
2009-05-22 10:53:45 +08:00
|
|
|
Generic_GCC::Generic_GCC(const HostInfo &Host, const llvm::Triple& Triple)
|
2009-09-09 23:08:12 +08:00
|
|
|
: ToolChain(Host, Triple) {
|
2010-08-02 06:29:51 +08:00
|
|
|
getProgramPaths().push_back(getDriver().getInstalledDir());
|
2011-03-02 06:50:47 +08:00
|
|
|
if (getDriver().getInstalledDir() != getDriver().Dir)
|
2010-08-02 06:29:51 +08:00
|
|
|
getProgramPaths().push_back(getDriver().Dir);
|
2009-03-24 00:15:50 +08:00
|
|
|
}
|
|
|
|
|
2009-03-20 08:20:03 +08:00
|
|
|
Generic_GCC::~Generic_GCC() {
|
|
|
|
// Free tool implementations.
|
|
|
|
for (llvm::DenseMap<unsigned, Tool*>::iterator
|
|
|
|
it = Tools.begin(), ie = Tools.end(); it != ie; ++it)
|
|
|
|
delete it->second;
|
|
|
|
}
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
Tool &Generic_GCC::SelectTool(const Compilation &C,
|
2009-03-20 08:20:03 +08:00
|
|
|
const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
2009-12-22 02:54:17 +08:00
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
2009-03-20 08:20:03 +08:00
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
2009-03-20 08:57:52 +08:00
|
|
|
case Action::InputClass:
|
|
|
|
case Action::BindArchClass:
|
2009-03-20 08:20:03 +08:00
|
|
|
assert(0 && "Invalid tool kind.");
|
|
|
|
case Action::PreprocessJobClass:
|
|
|
|
T = new tools::gcc::Preprocess(*this); break;
|
|
|
|
case Action::PrecompileJobClass:
|
|
|
|
T = new tools::gcc::Precompile(*this); break;
|
|
|
|
case Action::AnalyzeJobClass:
|
|
|
|
T = new tools::Clang(*this); break;
|
|
|
|
case Action::CompileJobClass:
|
|
|
|
T = new tools::gcc::Compile(*this); break;
|
|
|
|
case Action::AssembleJobClass:
|
|
|
|
T = new tools::gcc::Assemble(*this); break;
|
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::gcc::Link(*this); break;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-03-20 08:57:52 +08:00
|
|
|
// This is a bit ungeneric, but the only platform using a driver
|
|
|
|
// driver is Darwin.
|
|
|
|
case Action::LipoJobClass:
|
|
|
|
T = new tools::darwin::Lipo(*this); break;
|
2010-06-05 02:28:36 +08:00
|
|
|
case Action::DsymutilJobClass:
|
|
|
|
T = new tools::darwin::Dsymutil(*this); break;
|
2009-03-20 08:20:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Generic_GCC::IsUnwindTablesDefault() const {
|
2009-03-20 08:57:52 +08:00
|
|
|
// FIXME: Gross; we should probably have some separate target
|
|
|
|
// definition, possibly even reusing the one in clang.
|
2009-03-20 08:20:03 +08:00
|
|
|
return getArchName() == "x86_64";
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Generic_GCC::GetDefaultRelocationModel() const {
|
|
|
|
return "static";
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Generic_GCC::GetForcedPicModel() const {
|
|
|
|
return 0;
|
|
|
|
}
|
2009-03-25 12:13:45 +08:00
|
|
|
|
2010-03-05 05:07:38 +08:00
|
|
|
/// TCEToolChain - A tool chain using the llvm bitcode tools to perform
|
|
|
|
/// all subcommands. See http://tce.cs.tut.fi for our peculiar target.
|
|
|
|
/// Currently does not support anything else but compilation.
|
|
|
|
|
|
|
|
TCEToolChain::TCEToolChain(const HostInfo &Host, const llvm::Triple& Triple)
|
|
|
|
: ToolChain(Host, Triple) {
|
|
|
|
// Path mangling to find libexec
|
|
|
|
std::string Path(getDriver().Dir);
|
|
|
|
|
|
|
|
Path += "/../libexec";
|
|
|
|
getProgramPaths().push_back(Path);
|
|
|
|
}
|
|
|
|
|
|
|
|
TCEToolChain::~TCEToolChain() {
|
|
|
|
for (llvm::DenseMap<unsigned, Tool*>::iterator
|
|
|
|
it = Tools.begin(), ie = Tools.end(); it != ie; ++it)
|
|
|
|
delete it->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TCEToolChain::IsMathErrnoDefault() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TCEToolChain::IsUnwindTablesDefault() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *TCEToolChain::GetDefaultRelocationModel() const {
|
|
|
|
return "static";
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *TCEToolChain::GetForcedPicModel() const {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool &TCEToolChain::SelectTool(const Compilation &C,
|
|
|
|
const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
|
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::PreprocessJobClass:
|
|
|
|
T = new tools::gcc::Preprocess(*this); break;
|
|
|
|
case Action::AnalyzeJobClass:
|
|
|
|
T = new tools::Clang(*this); break;
|
|
|
|
default:
|
|
|
|
assert(false && "Unsupported action for TCE target.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
2009-06-30 04:52:51 +08:00
|
|
|
/// OpenBSD - OpenBSD tool chain which can call as(1) and ld(1) directly.
|
|
|
|
|
|
|
|
OpenBSD::OpenBSD(const HostInfo &Host, const llvm::Triple& Triple)
|
2010-10-30 04:14:02 +08:00
|
|
|
: Generic_ELF(Host, Triple) {
|
2009-12-22 02:54:17 +08:00
|
|
|
getFilePaths().push_back(getDriver().Dir + "/../lib");
|
2009-06-30 04:52:51 +08:00
|
|
|
getFilePaths().push_back("/usr/lib");
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
2009-12-22 02:54:17 +08:00
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
2009-06-30 04:52:51 +08:00
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
2010-11-08 07:13:01 +08:00
|
|
|
bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
|
|
|
|
options::OPT_no_integrated_as,
|
|
|
|
IsIntegratedAssemblerDefault());
|
|
|
|
|
2009-06-30 04:52:51 +08:00
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
2010-11-08 07:13:01 +08:00
|
|
|
case Action::AssembleJobClass: {
|
|
|
|
if (UseIntegratedAs)
|
|
|
|
T = new tools::ClangAs(*this);
|
|
|
|
else
|
|
|
|
T = new tools::openbsd::Assemble(*this);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-30 04:52:51 +08:00
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::openbsd::Link(*this); break;
|
|
|
|
default:
|
|
|
|
T = &Generic_GCC::SelectTool(C, JA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
2009-03-31 05:06:03 +08:00
|
|
|
/// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
|
|
|
|
|
2010-08-02 13:43:59 +08:00
|
|
|
FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple)
|
2010-10-30 04:14:02 +08:00
|
|
|
: Generic_ELF(Host, Triple) {
|
2010-08-02 13:43:59 +08:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
2009-04-03 02:30:04 +08:00
|
|
|
if (Lib32) {
|
|
|
|
getFilePaths().push_back("/usr/lib32");
|
|
|
|
} else {
|
|
|
|
getFilePaths().push_back("/usr/lib");
|
|
|
|
}
|
2009-03-31 05:06:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
2009-12-22 02:54:17 +08:00
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
2009-03-31 05:06:03 +08:00
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
2010-11-09 01:46:39 +08:00
|
|
|
bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
|
|
|
|
options::OPT_no_integrated_as,
|
|
|
|
IsIntegratedAssemblerDefault());
|
|
|
|
|
2009-03-31 05:06:03 +08:00
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
2009-04-01 01:45:15 +08:00
|
|
|
case Action::AssembleJobClass:
|
2010-11-09 01:46:39 +08:00
|
|
|
if (UseIntegratedAs)
|
|
|
|
T = new tools::ClangAs(*this);
|
|
|
|
else
|
|
|
|
T = new tools::freebsd::Assemble(*this);
|
2010-11-09 03:39:10 +08:00
|
|
|
break;
|
2009-04-02 03:36:32 +08:00
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::freebsd::Link(*this); break;
|
2009-03-31 05:06:03 +08:00
|
|
|
default:
|
|
|
|
T = &Generic_GCC::SelectTool(C, JA);
|
2011-02-03 02:59:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
|
|
|
|
|
|
|
|
NetBSD::NetBSD(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;
|
|
|
|
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) {
|
|
|
|
getFilePaths().push_back("/usr/lib/i386");
|
|
|
|
} else {
|
|
|
|
getFilePaths().push_back("/usr/lib");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool &NetBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
|
|
|
bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
|
|
|
|
options::OPT_no_integrated_as,
|
|
|
|
IsIntegratedAssemblerDefault());
|
|
|
|
|
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::AssembleJobClass:
|
|
|
|
if (UseIntegratedAs)
|
|
|
|
T = new tools::ClangAs(*this);
|
|
|
|
else
|
|
|
|
T = new tools::netbsd::Assemble(*this);
|
|
|
|
break;
|
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::netbsd::Link(*this); break;
|
|
|
|
default:
|
|
|
|
T = &Generic_GCC::SelectTool(C, JA);
|
2009-03-31 05:06:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
2009-05-03 02:28:39 +08:00
|
|
|
|
2010-07-08 00:01:42 +08:00
|
|
|
/// Minix - Minix tool chain which can call as(1) and ld(1) directly.
|
|
|
|
|
|
|
|
Minix::Minix(const HostInfo &Host, const llvm::Triple& Triple)
|
|
|
|
: Generic_GCC(Host, Triple) {
|
|
|
|
getFilePaths().push_back(getDriver().Dir + "/../lib");
|
|
|
|
getFilePaths().push_back("/usr/lib");
|
|
|
|
getFilePaths().push_back("/usr/gnu/lib");
|
|
|
|
getFilePaths().push_back("/usr/gnu/lib/gcc/i686-pc-minix/4.4.3");
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool &Minix::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::AssembleJobClass:
|
|
|
|
T = new tools::minix::Assemble(*this); break;
|
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::minix::Link(*this); break;
|
|
|
|
default:
|
|
|
|
T = &Generic_GCC::SelectTool(C, JA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
2009-08-22 09:06:46 +08:00
|
|
|
/// AuroraUX - AuroraUX tool chain which can call as(1) and ld(1) directly.
|
|
|
|
|
|
|
|
AuroraUX::AuroraUX(const HostInfo &Host, const llvm::Triple& Triple)
|
|
|
|
: Generic_GCC(Host, Triple) {
|
|
|
|
|
2010-08-02 06:29:51 +08:00
|
|
|
getProgramPaths().push_back(getDriver().getInstalledDir());
|
2011-03-02 06:50:47 +08:00
|
|
|
if (getDriver().getInstalledDir() != getDriver().Dir)
|
2010-08-02 06:29:51 +08:00
|
|
|
getProgramPaths().push_back(getDriver().Dir);
|
2009-08-22 09:06:46 +08:00
|
|
|
|
2009-12-22 02:54:17 +08:00
|
|
|
getFilePaths().push_back(getDriver().Dir + "/../lib");
|
2009-08-22 09:06:46 +08:00
|
|
|
getFilePaths().push_back("/usr/lib");
|
|
|
|
getFilePaths().push_back("/usr/sfw/lib");
|
|
|
|
getFilePaths().push_back("/opt/gcc4/lib");
|
2009-10-15 15:44:07 +08:00
|
|
|
getFilePaths().push_back("/opt/gcc4/lib/gcc/i386-pc-solaris2.11/4.2.4");
|
2009-08-22 09:06:46 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool &AuroraUX::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
2009-12-22 02:54:17 +08:00
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
2009-08-22 09:06:46 +08:00
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::AssembleJobClass:
|
|
|
|
T = new tools::auroraux::Assemble(*this); break;
|
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::auroraux::Link(*this); break;
|
|
|
|
default:
|
|
|
|
T = &Generic_GCC::SelectTool(C, JA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-26 15:52:18 +08:00
|
|
|
/// Linux toolchain (very bare-bones at the moment).
|
|
|
|
|
2010-11-08 04:14:31 +08:00
|
|
|
enum LinuxDistro {
|
2011-02-25 14:39:53 +08:00
|
|
|
ArchLinux,
|
2010-11-08 04:14:31 +08:00
|
|
|
DebianLenny,
|
|
|
|
DebianSqueeze,
|
2010-11-11 10:07:13 +08:00
|
|
|
Exherbo,
|
2010-11-08 04:14:31 +08:00
|
|
|
Fedora13,
|
|
|
|
Fedora14,
|
|
|
|
OpenSuse11_3,
|
2011-03-14 23:39:50 +08:00
|
|
|
UbuntuHardy,
|
|
|
|
UbuntuIntrepid,
|
2010-11-10 13:00:22 +08:00
|
|
|
UbuntuJaunty,
|
2010-11-15 17:01:52 +08:00
|
|
|
UbuntuKarmic,
|
2010-11-08 04:14:31 +08:00
|
|
|
UbuntuLucid,
|
|
|
|
UbuntuMaverick,
|
|
|
|
UnknownDistro
|
|
|
|
};
|
|
|
|
|
|
|
|
static bool IsFedora(enum LinuxDistro Distro) {
|
|
|
|
return Distro == Fedora13 || Distro == Fedora14;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool IsOpenSuse(enum LinuxDistro Distro) {
|
|
|
|
return Distro == OpenSuse11_3;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool IsDebian(enum LinuxDistro Distro) {
|
|
|
|
return Distro == DebianLenny || Distro == DebianSqueeze;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool IsUbuntu(enum LinuxDistro Distro) {
|
2011-03-14 23:39:50 +08:00
|
|
|
return Distro == UbuntuHardy || Distro == UbuntuIntrepid ||
|
|
|
|
Distro == UbuntuLucid || Distro == UbuntuMaverick ||
|
2010-11-15 17:01:52 +08:00
|
|
|
Distro == UbuntuJaunty || Distro == UbuntuKarmic;
|
2010-11-08 04:14:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool IsDebianBased(enum LinuxDistro Distro) {
|
|
|
|
return IsDebian(Distro) || IsUbuntu(Distro);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool HasMultilib(llvm::Triple::ArchType Arch, enum LinuxDistro Distro) {
|
2010-11-11 10:07:13 +08:00
|
|
|
if (Arch == llvm::Triple::x86_64) {
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
|
|
|
if (Distro == Exherbo &&
|
|
|
|
(llvm::sys::fs::exists("/usr/lib32/libc.so", Exists) || !Exists))
|
2010-11-11 10:07:13 +08:00
|
|
|
return false;
|
|
|
|
|
2010-11-08 04:14:31 +08:00
|
|
|
return true;
|
2010-11-11 10:07:13 +08:00
|
|
|
}
|
2010-11-08 04:14:31 +08:00
|
|
|
if (Arch == llvm::Triple::x86 && IsDebianBased(Distro))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
|
2010-12-16 11:28:14 +08:00
|
|
|
llvm::OwningPtr<llvm::MemoryBuffer> File;
|
|
|
|
if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) {
|
|
|
|
llvm::StringRef Data = File.get()->getBuffer();
|
2010-11-08 04:14:31 +08:00
|
|
|
llvm::SmallVector<llvm::StringRef, 8> Lines;
|
|
|
|
Data.split(Lines, "\n");
|
|
|
|
for (unsigned int i = 0, s = Lines.size(); i < s; ++ i) {
|
2011-03-14 23:39:50 +08:00
|
|
|
if (Lines[i] == "DISTRIB_CODENAME=hardy")
|
|
|
|
return UbuntuHardy;
|
|
|
|
if (Lines[i] == "DISTRIB_CODENAME=intrepid")
|
|
|
|
return UbuntuIntrepid;
|
2010-11-08 04:14:31 +08:00
|
|
|
if (Lines[i] == "DISTRIB_CODENAME=maverick")
|
|
|
|
return UbuntuMaverick;
|
|
|
|
else if (Lines[i] == "DISTRIB_CODENAME=lucid")
|
|
|
|
return UbuntuLucid;
|
2010-11-10 13:00:22 +08:00
|
|
|
else if (Lines[i] == "DISTRIB_CODENAME=jaunty")
|
2010-12-16 11:28:14 +08:00
|
|
|
return UbuntuJaunty;
|
2010-11-15 17:01:52 +08:00
|
|
|
else if (Lines[i] == "DISTRIB_CODENAME=karmic")
|
|
|
|
return UbuntuKarmic;
|
2010-11-08 04:14:31 +08:00
|
|
|
}
|
|
|
|
return UnknownDistro;
|
|
|
|
}
|
|
|
|
|
2010-12-16 11:28:14 +08:00
|
|
|
if (!llvm::MemoryBuffer::getFile("/etc/redhat-release", File)) {
|
|
|
|
llvm::StringRef Data = File.get()->getBuffer();
|
2010-11-08 04:14:31 +08:00
|
|
|
if (Data.startswith("Fedora release 14 (Laughlin)"))
|
|
|
|
return Fedora14;
|
|
|
|
else if (Data.startswith("Fedora release 13 (Goddard)"))
|
|
|
|
return Fedora13;
|
|
|
|
return UnknownDistro;
|
|
|
|
}
|
|
|
|
|
2010-12-16 11:28:14 +08:00
|
|
|
if (!llvm::MemoryBuffer::getFile("/etc/debian_version", File)) {
|
|
|
|
llvm::StringRef Data = File.get()->getBuffer();
|
2010-11-08 04:14:31 +08:00
|
|
|
if (Data[0] == '5')
|
|
|
|
return DebianLenny;
|
|
|
|
else if (Data.startswith("squeeze/sid"))
|
|
|
|
return DebianSqueeze;
|
|
|
|
return UnknownDistro;
|
|
|
|
}
|
|
|
|
|
2010-12-16 11:28:14 +08:00
|
|
|
if (!llvm::MemoryBuffer::getFile("/etc/SuSE-release", File)) {
|
|
|
|
llvm::StringRef Data = File.get()->getBuffer();
|
2010-11-08 04:14:31 +08:00
|
|
|
if (Data.startswith("openSUSE 11.3"))
|
|
|
|
return OpenSuse11_3;
|
|
|
|
return UnknownDistro;
|
|
|
|
}
|
|
|
|
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
|
|
|
if (!llvm::sys::fs::exists("/etc/exherbo-release", Exists) && Exists)
|
2010-11-11 10:07:13 +08:00
|
|
|
return Exherbo;
|
|
|
|
|
2011-02-25 14:39:53 +08:00
|
|
|
if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists)
|
|
|
|
return ArchLinux;
|
|
|
|
|
2010-11-08 04:14:31 +08:00
|
|
|
return UnknownDistro;
|
|
|
|
}
|
|
|
|
|
2011-01-01 01:31:54 +08:00
|
|
|
Linux::Linux(const HostInfo &Host, const llvm::Triple &Triple)
|
2010-10-30 04:14:02 +08:00
|
|
|
: Generic_ELF(Host, Triple) {
|
2010-11-08 04:14:31 +08:00
|
|
|
llvm::Triple::ArchType Arch =
|
|
|
|
llvm::Triple(getDriver().DefaultHostTriple).getArch();
|
|
|
|
|
|
|
|
std::string Suffix32 = "";
|
|
|
|
if (Arch == llvm::Triple::x86_64)
|
|
|
|
Suffix32 = "/32";
|
|
|
|
|
|
|
|
std::string Suffix64 = "";
|
|
|
|
if (Arch == llvm::Triple::x86)
|
|
|
|
Suffix64 = "/64";
|
|
|
|
|
|
|
|
std::string Lib32 = "lib";
|
|
|
|
|
2011-01-10 10:34:13 +08:00
|
|
|
bool Exists;
|
|
|
|
if (!llvm::sys::fs::exists("/lib32", Exists) && Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
Lib32 = "lib32";
|
|
|
|
|
|
|
|
std::string Lib64 = "lib";
|
2011-01-13 07:54:48 +08:00
|
|
|
bool Symlink;
|
2011-01-13 09:35:58 +08:00
|
|
|
if (!llvm::sys::fs::exists("/lib64", Exists) && Exists &&
|
|
|
|
(llvm::sys::fs::is_symlink("/lib64", Symlink) || !Symlink))
|
2010-11-08 04:14:31 +08:00
|
|
|
Lib64 = "lib64";
|
|
|
|
|
|
|
|
std::string GccTriple = "";
|
2011-03-07 03:11:49 +08:00
|
|
|
if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
|
2011-01-10 10:34:13 +08:00
|
|
|
if (!llvm::sys::fs::exists("/usr/lib/gcc/arm-linux-gnueabi", Exists) &&
|
|
|
|
Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "arm-linux-gnueabi";
|
|
|
|
} else if (Arch == llvm::Triple::x86_64) {
|
2011-01-10 10:34:13 +08:00
|
|
|
if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-linux-gnu", Exists) &&
|
|
|
|
Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "x86_64-linux-gnu";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-unknown-linux-gnu",
|
|
|
|
Exists) && Exists)
|
2010-11-17 08:25:26 +08:00
|
|
|
GccTriple = "x86_64-unknown-linux-gnu";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-pc-linux-gnu",
|
|
|
|
Exists) && Exists)
|
2010-11-11 10:07:13 +08:00
|
|
|
GccTriple = "x86_64-pc-linux-gnu";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-redhat-linux",
|
|
|
|
Exists) && Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "x86_64-redhat-linux";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib64/gcc/x86_64-suse-linux",
|
|
|
|
Exists) && Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "x86_64-suse-linux";
|
2011-02-02 07:03:29 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/x86_64-manbo-linux-gnu",
|
|
|
|
Exists) && Exists)
|
|
|
|
GccTriple = "x86_64-manbo-linux-gnu";
|
2010-11-08 04:14:31 +08:00
|
|
|
} else if (Arch == llvm::Triple::x86) {
|
2011-01-10 10:34:13 +08:00
|
|
|
if (!llvm::sys::fs::exists("/usr/lib/gcc/i686-linux-gnu", Exists) && Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "i686-linux-gnu";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/i686-pc-linux-gnu", Exists) &&
|
|
|
|
Exists)
|
2010-11-20 01:26:57 +08:00
|
|
|
GccTriple = "i686-pc-linux-gnu";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/i486-linux-gnu", Exists) &&
|
|
|
|
Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "i486-linux-gnu";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/i686-redhat-linux", Exists) &&
|
|
|
|
Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "i686-redhat-linux";
|
2011-01-10 10:34:13 +08:00
|
|
|
else if (!llvm::sys::fs::exists("/usr/lib/gcc/i586-suse-linux", Exists) &&
|
|
|
|
Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
GccTriple = "i586-suse-linux";
|
|
|
|
}
|
|
|
|
|
2011-02-25 14:39:53 +08:00
|
|
|
const char* GccVersions[] = {"4.5.2", "4.5.1", "4.5", "4.4.5", "4.4.4",
|
|
|
|
"4.4.3", "4.4", "4.3.4", "4.3.3", "4.3.2",
|
2011-03-14 23:39:50 +08:00
|
|
|
"4.3", "4.2.4", "4.2.3", "4.2.2", "4.2.1",
|
|
|
|
"4.2"};
|
2010-11-08 04:14:31 +08:00
|
|
|
std::string Base = "";
|
|
|
|
for (unsigned i = 0; i < sizeof(GccVersions)/sizeof(char*); ++i) {
|
|
|
|
std::string Suffix = GccTriple + "/" + GccVersions[i];
|
|
|
|
std::string t1 = "/usr/lib/gcc/" + Suffix;
|
2011-01-10 10:34:13 +08:00
|
|
|
if (!llvm::sys::fs::exists(t1 + "/crtbegin.o", Exists) && Exists) {
|
2010-11-08 04:14:31 +08:00
|
|
|
Base = t1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
std::string t2 = "/usr/lib64/gcc/" + Suffix;
|
2011-01-10 10:34:13 +08:00
|
|
|
if (!llvm::sys::fs::exists(t2 + "/crtbegin.o", Exists) && Exists) {
|
2010-11-08 04:14:31 +08:00
|
|
|
Base = t2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
path_list &Paths = getFilePaths();
|
|
|
|
bool Is32Bits = getArch() == llvm::Triple::x86;
|
|
|
|
|
|
|
|
std::string Suffix;
|
|
|
|
std::string Lib;
|
|
|
|
|
|
|
|
if (Is32Bits) {
|
|
|
|
Suffix = Suffix32;
|
|
|
|
Lib = Lib32;
|
|
|
|
} else {
|
|
|
|
Suffix = Suffix64;
|
|
|
|
Lib = Lib64;
|
|
|
|
}
|
|
|
|
|
|
|
|
llvm::sys::Path LinkerPath(Base + "/../../../../" + GccTriple + "/bin/ld");
|
2011-01-10 10:34:13 +08:00
|
|
|
if (!llvm::sys::fs::exists(LinkerPath.str(), Exists) && Exists)
|
2010-11-08 04:14:31 +08:00
|
|
|
Linker = LinkerPath.str();
|
|
|
|
else
|
|
|
|
Linker = GetProgramPath("ld");
|
|
|
|
|
|
|
|
LinuxDistro Distro = DetectLinuxDistro(Arch);
|
|
|
|
|
2010-11-08 22:48:47 +08:00
|
|
|
if (IsUbuntu(Distro)) {
|
|
|
|
ExtraOpts.push_back("-z");
|
|
|
|
ExtraOpts.push_back("relro");
|
|
|
|
}
|
2010-11-08 04:14:31 +08:00
|
|
|
|
2011-03-07 03:11:49 +08:00
|
|
|
if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb)
|
2010-11-08 04:14:31 +08:00
|
|
|
ExtraOpts.push_back("-X");
|
|
|
|
|
|
|
|
if (IsFedora(Distro) || Distro == UbuntuMaverick)
|
|
|
|
ExtraOpts.push_back("--hash-style=gnu");
|
|
|
|
|
2010-11-15 17:01:52 +08:00
|
|
|
if (IsDebian(Distro) || Distro == UbuntuLucid || Distro == UbuntuJaunty ||
|
|
|
|
Distro == UbuntuKarmic)
|
2010-11-08 04:14:31 +08:00
|
|
|
ExtraOpts.push_back("--hash-style=both");
|
|
|
|
|
|
|
|
if (IsFedora(Distro))
|
|
|
|
ExtraOpts.push_back("--no-add-needed");
|
|
|
|
|
2010-11-10 13:00:22 +08:00
|
|
|
if (Distro == DebianSqueeze || IsOpenSuse(Distro) ||
|
2010-11-15 17:01:52 +08:00
|
|
|
IsFedora(Distro) || Distro == UbuntuLucid || Distro == UbuntuMaverick ||
|
|
|
|
Distro == UbuntuKarmic)
|
2010-11-08 04:14:31 +08:00
|
|
|
ExtraOpts.push_back("--build-id");
|
|
|
|
|
2011-02-25 14:39:53 +08:00
|
|
|
if (Distro == ArchLinux)
|
|
|
|
Lib = "lib";
|
|
|
|
|
2010-11-08 04:14:31 +08:00
|
|
|
Paths.push_back(Base + Suffix);
|
|
|
|
if (HasMultilib(Arch, Distro)) {
|
|
|
|
if (IsOpenSuse(Distro) && Is32Bits)
|
|
|
|
Paths.push_back(Base + "/../../../../" + GccTriple + "/lib/../lib");
|
|
|
|
Paths.push_back(Base + "/../../../../" + Lib);
|
|
|
|
Paths.push_back("/lib/../" + Lib);
|
|
|
|
Paths.push_back("/usr/lib/../" + Lib);
|
|
|
|
}
|
|
|
|
if (!Suffix.empty())
|
|
|
|
Paths.push_back(Base);
|
|
|
|
if (IsOpenSuse(Distro))
|
|
|
|
Paths.push_back(Base + "/../../../../" + GccTriple + "/lib");
|
|
|
|
Paths.push_back(Base + "/../../..");
|
|
|
|
if (Arch == getArch() && IsUbuntu(Distro))
|
|
|
|
Paths.push_back("/usr/lib/" + GccTriple);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Linux::HasNativeLLVMSupport() const {
|
|
|
|
return true;
|
2009-05-26 15:52:18 +08:00
|
|
|
}
|
|
|
|
|
2010-08-10 08:25:48 +08:00
|
|
|
Tool &Linux::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
2010-11-08 07:13:01 +08:00
|
|
|
bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
|
|
|
|
options::OPT_no_integrated_as,
|
|
|
|
IsIntegratedAssemblerDefault());
|
|
|
|
|
2010-08-10 08:25:48 +08:00
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::AssembleJobClass:
|
2010-11-08 07:13:01 +08:00
|
|
|
if (UseIntegratedAs)
|
|
|
|
T = new tools::ClangAs(*this);
|
|
|
|
else
|
|
|
|
T = new tools::linuxtools::Assemble(*this);
|
|
|
|
break;
|
2010-11-08 04:14:31 +08:00
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::linuxtools::Link(*this); break;
|
2010-08-10 08:25:48 +08:00
|
|
|
default:
|
|
|
|
T = &Generic_GCC::SelectTool(C, JA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
2009-05-03 02:28:39 +08:00
|
|
|
/// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
|
|
|
|
|
2009-05-22 10:53:45 +08:00
|
|
|
DragonFly::DragonFly(const HostInfo &Host, const llvm::Triple& Triple)
|
2010-10-30 04:14:02 +08:00
|
|
|
: Generic_ELF(Host, Triple) {
|
2009-05-03 02:28:39 +08:00
|
|
|
|
|
|
|
// Path mangling to find libexec
|
2010-08-02 06:29:51 +08:00
|
|
|
getProgramPaths().push_back(getDriver().getInstalledDir());
|
2011-03-02 06:50:47 +08:00
|
|
|
if (getDriver().getInstalledDir() != getDriver().Dir)
|
2010-08-02 06:29:51 +08:00
|
|
|
getProgramPaths().push_back(getDriver().Dir);
|
2009-05-03 02:28:39 +08:00
|
|
|
|
2009-12-22 02:54:17 +08:00
|
|
|
getFilePaths().push_back(getDriver().Dir + "/../lib");
|
2009-05-03 02:28:39 +08:00
|
|
|
getFilePaths().push_back("/usr/lib");
|
|
|
|
getFilePaths().push_back("/usr/lib/gcc41");
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool &DragonFly::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
2009-12-22 02:54:17 +08:00
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
2009-05-03 02:28:39 +08:00
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::AssembleJobClass:
|
|
|
|
T = new tools::dragonfly::Assemble(*this); break;
|
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::dragonfly::Link(*this); break;
|
|
|
|
default:
|
|
|
|
T = &Generic_GCC::SelectTool(C, JA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
2010-08-22 05:55:07 +08:00
|
|
|
|
|
|
|
Windows::Windows(const HostInfo &Host, const llvm::Triple& Triple)
|
|
|
|
: ToolChain(Host, Triple) {
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool &Windows::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|
|
|
Action::ActionClass Key;
|
|
|
|
if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
|
|
|
|
Key = Action::AnalyzeJobClass;
|
|
|
|
else
|
|
|
|
Key = JA.getKind();
|
|
|
|
|
|
|
|
Tool *&T = Tools[Key];
|
|
|
|
if (!T) {
|
|
|
|
switch (Key) {
|
|
|
|
case Action::InputClass:
|
|
|
|
case Action::BindArchClass:
|
2010-08-22 14:56:37 +08:00
|
|
|
case Action::LipoJobClass:
|
|
|
|
case Action::DsymutilJobClass:
|
2010-08-22 05:55:07 +08:00
|
|
|
assert(0 && "Invalid tool kind.");
|
|
|
|
case Action::PreprocessJobClass:
|
|
|
|
case Action::PrecompileJobClass:
|
|
|
|
case Action::AnalyzeJobClass:
|
|
|
|
case Action::CompileJobClass:
|
|
|
|
T = new tools::Clang(*this); break;
|
|
|
|
case Action::AssembleJobClass:
|
|
|
|
T = new tools::ClangAs(*this); break;
|
|
|
|
case Action::LinkJobClass:
|
|
|
|
T = new tools::visualstudio::Link(*this); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return *T;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Windows::IsIntegratedAssemblerDefault() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Windows::IsUnwindTablesDefault() const {
|
|
|
|
// FIXME: Gross; we should probably have some separate target
|
|
|
|
// definition, possibly even reusing the one in clang.
|
|
|
|
return getArchName() == "x86_64";
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Windows::GetDefaultRelocationModel() const {
|
|
|
|
return "static";
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *Windows::GetForcedPicModel() const {
|
|
|
|
if (getArchName() == "x86_64")
|
|
|
|
return "pic";
|
|
|
|
return 0;
|
|
|
|
}
|