2009-03-18 05:38:00 +08:00
|
|
|
//===--- 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_
|
|
|
|
|
2012-12-04 17:13:33 +08:00
|
|
|
#include "Tools.h"
|
|
|
|
#include "clang/Basic/VersionTuple.h"
|
2009-03-18 06:07:31 +08:00
|
|
|
#include "clang/Driver/Action.h"
|
2014-02-12 11:21:20 +08:00
|
|
|
#include "clang/Driver/Multilib.h"
|
2009-03-18 05:38:00 +08:00
|
|
|
#include "clang/Driver/ToolChain.h"
|
2009-03-18 06:07:31 +08:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2014-02-12 11:21:20 +08:00
|
|
|
#include "llvm/ADT/Optional.h"
|
2009-03-18 05:38:00 +08:00
|
|
|
#include "llvm/Support/Compiler.h"
|
2013-08-15 02:38:51 +08:00
|
|
|
#include <set>
|
2014-01-07 19:51:46 +08:00
|
|
|
#include <vector>
|
2013-06-12 04:06:05 +08:00
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
namespace clang {
|
|
|
|
namespace driver {
|
2009-03-18 06:18:43 +08:00
|
|
|
namespace toolchains {
|
2009-03-18 05:38:00 +08:00
|
|
|
|
2009-09-18 16:15:13 +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.
|
2010-05-12 04:16:05 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain {
|
2009-03-31 05:06:03 +08:00
|
|
|
protected:
|
2011-11-07 07:39:34 +08:00
|
|
|
/// \brief Struct to store and manipulate GCC versions.
|
|
|
|
///
|
|
|
|
/// We rely on assumptions about the form and structure of GCC version
|
|
|
|
/// numbers: they consist of at most three '.'-separated components, and each
|
|
|
|
/// component is a non-negative integer except for the last component. For
|
|
|
|
/// the last component we are very flexible in order to tolerate release
|
|
|
|
/// candidates or 'x' wildcards.
|
|
|
|
///
|
|
|
|
/// Note that the ordering established among GCCVersions is based on the
|
|
|
|
/// preferred version string to use. For example we prefer versions without
|
|
|
|
/// a hard-coded patch number to those with a hard coded patch number.
|
|
|
|
///
|
|
|
|
/// Currently this doesn't provide any logic for textual suffixes to patches
|
|
|
|
/// in the way that (for example) Debian's version format does. If that ever
|
|
|
|
/// becomes necessary, it can be added.
|
|
|
|
struct GCCVersion {
|
|
|
|
/// \brief The unparsed text of the version.
|
|
|
|
std::string Text;
|
|
|
|
|
|
|
|
/// \brief The parsed major, minor, and patch numbers.
|
|
|
|
int Major, Minor, Patch;
|
|
|
|
|
2013-08-26 16:59:53 +08:00
|
|
|
/// \brief The text of the parsed major, and major+minor versions.
|
|
|
|
std::string MajorStr, MinorStr;
|
|
|
|
|
2011-11-07 07:39:34 +08:00
|
|
|
/// \brief Any textual suffix on the patch number.
|
|
|
|
std::string PatchSuffix;
|
|
|
|
|
|
|
|
static GCCVersion Parse(StringRef VersionText);
|
2013-08-10 01:17:48 +08:00
|
|
|
bool isOlderThan(int RHSMajor, int RHSMinor, int RHSPatch,
|
|
|
|
StringRef RHSPatchSuffix = StringRef()) const;
|
|
|
|
bool operator<(const GCCVersion &RHS) const {
|
|
|
|
return isOlderThan(RHS.Major, RHS.Minor, RHS.Patch, RHS.PatchSuffix);
|
|
|
|
}
|
2011-11-07 07:39:34 +08:00
|
|
|
bool operator>(const GCCVersion &RHS) const { return RHS < *this; }
|
|
|
|
bool operator<=(const GCCVersion &RHS) const { return !(*this > RHS); }
|
|
|
|
bool operator>=(const GCCVersion &RHS) const { return !(*this < RHS); }
|
|
|
|
};
|
|
|
|
|
|
|
|
/// \brief This is a class to find a viable GCC installation for Clang to
|
|
|
|
/// use.
|
|
|
|
///
|
|
|
|
/// This class tries to find a GCC installation on the system, and report
|
|
|
|
/// information about it. It starts from the host information provided to the
|
|
|
|
/// Driver, and has logic for fuzzing that where appropriate.
|
|
|
|
class GCCInstallationDetector {
|
|
|
|
bool IsValid;
|
2012-01-25 03:28:29 +08:00
|
|
|
llvm::Triple GCCTriple;
|
2011-11-07 07:39:34 +08:00
|
|
|
|
|
|
|
// FIXME: These might be better as path objects.
|
2012-01-25 03:21:42 +08:00
|
|
|
std::string GCCInstallPath;
|
|
|
|
std::string GCCParentLibPath;
|
2014-02-12 11:21:20 +08:00
|
|
|
|
|
|
|
/// The primary multilib appropriate for the given flags.
|
|
|
|
Multilib SelectedMultilib;
|
|
|
|
/// On Biarch systems, this corresponds to the default multilib when
|
|
|
|
/// targeting the non-default multilib. Otherwise, it is empty.
|
|
|
|
llvm::Optional<Multilib> BiarchSibling;
|
2011-11-07 07:39:34 +08:00
|
|
|
|
|
|
|
GCCVersion Version;
|
|
|
|
|
2013-07-31 01:57:09 +08:00
|
|
|
// We retain the list of install paths that were considered and rejected in
|
|
|
|
// order to print out detailed information in verbose mode.
|
2013-08-15 02:38:51 +08:00
|
|
|
std::set<std::string> CandidateGCCInstallPaths;
|
2013-07-31 01:57:09 +08:00
|
|
|
|
2014-02-12 11:21:20 +08:00
|
|
|
/// The set of multilibs that the detected installation supports.
|
|
|
|
MultilibSet Multilibs;
|
|
|
|
|
2011-11-07 07:39:34 +08:00
|
|
|
public:
|
2013-12-07 02:32:18 +08:00
|
|
|
GCCInstallationDetector() : IsValid(false) {}
|
|
|
|
void init(const Driver &D, const llvm::Triple &TargetTriple,
|
2013-06-17 21:59:19 +08:00
|
|
|
const llvm::opt::ArgList &Args);
|
2011-11-07 07:39:34 +08:00
|
|
|
|
|
|
|
/// \brief Check whether we detected a valid GCC install.
|
|
|
|
bool isValid() const { return IsValid; }
|
|
|
|
|
|
|
|
/// \brief Get the GCC triple for the detected install.
|
2012-01-25 03:28:29 +08:00
|
|
|
const llvm::Triple &getTriple() const { return GCCTriple; }
|
2011-11-07 07:39:34 +08:00
|
|
|
|
|
|
|
/// \brief Get the detected GCC installation path.
|
2012-01-25 03:21:42 +08:00
|
|
|
StringRef getInstallPath() const { return GCCInstallPath; }
|
2011-11-07 07:39:34 +08:00
|
|
|
|
|
|
|
/// \brief Get the detected GCC parent lib path.
|
2012-01-25 03:21:42 +08:00
|
|
|
StringRef getParentLibPath() const { return GCCParentLibPath; }
|
2011-11-07 07:39:34 +08:00
|
|
|
|
2014-02-12 11:21:20 +08:00
|
|
|
/// \brief Get the detected Multilib
|
|
|
|
const Multilib &getMultilib() const { return SelectedMultilib; }
|
|
|
|
|
|
|
|
/// \brief Get the whole MultilibSet
|
|
|
|
const MultilibSet &getMultilibs() const { return Multilibs; }
|
|
|
|
|
|
|
|
/// Get the biarch sibling multilib (if it exists).
|
|
|
|
/// \return true iff such a sibling exists
|
|
|
|
bool getBiarchSibling(Multilib &M) const;
|
2013-09-28 21:45:11 +08:00
|
|
|
|
2011-11-07 07:39:34 +08:00
|
|
|
/// \brief Get the detected GCC version string.
|
2012-06-19 09:26:10 +08:00
|
|
|
const GCCVersion &getVersion() const { return Version; }
|
2011-11-07 07:39:34 +08:00
|
|
|
|
2013-07-31 01:57:09 +08:00
|
|
|
/// \brief Print information about the detected GCC installation.
|
|
|
|
void print(raw_ostream &OS) const;
|
|
|
|
|
2011-11-07 07:39:34 +08:00
|
|
|
private:
|
2013-06-22 19:35:51 +08:00
|
|
|
static void
|
|
|
|
CollectLibDirsAndTriples(const llvm::Triple &TargetTriple,
|
|
|
|
const llvm::Triple &BiarchTriple,
|
|
|
|
SmallVectorImpl<StringRef> &LibDirs,
|
|
|
|
SmallVectorImpl<StringRef> &TripleAliases,
|
|
|
|
SmallVectorImpl<StringRef> &BiarchLibDirs,
|
|
|
|
SmallVectorImpl<StringRef> &BiarchTripleAliases);
|
Make a major refactoring to how the GCC installation detection works.
The fundamental shift here is to stop making *any* assumptions about the
*host* triple. Where these assumptions you ask? Why, they were in one of
the two target triples referenced of course. This was the single biggest
place where the previously named "host triple" was actually used as
such. ;] The reason we were reasoning about the host is in order to
detect the use of '-m32' or '-m64' flags to change the target. These
flags shift the default target only slightly, which typically means
a slight deviation from the host. When using these flags, the GCC
installation is under a different triple from the one actually targeted
in the compilation, and we used the host triple to find it.
Too bad that wasn't even correct. Consider an x86 Linux host which has
a PPC64 cross-compiling GCC toolchain installed. This toolchain is also
configured for multiarch compiling and can target PPC32 with eth '-m32'
flag. When targeting 'powerpc-linux-gnu' or some other PPC32 triple, we
have to look for the PPC64 variant of the triple to find the GCC
install, and that triple is neither the host nor target.
The new logic computes the multiarch's alternate triple from the target
triple, and looks under both sides. It also looks more aggressively for
the correct subdirectory of the GCC installation, and exposes the
subdirectory in a nice programmatic way. This '/32' or '/64' suffix is
something we can reuse in many other parts of the toolchain.
An important note -- while this likely fixes a large category of
cross-compile use cases, that's not my primary goal, and I've not done
testing (or added test cases) for scenarios that may now work. If
someone else wants to try more interesting PPC cross compiles, I'd love
to have reports. But my focus is on factoring away the references to the
"host" triple. The refactoring is my goal, and so I'm mostly relying on
the existing (pretty good) test coverage we have here.
Future patches will leverage this new functionality to factor out more
and more of the toolchain's triple manipulation.
llvm-svn: 148935
2012-01-25 15:21:38 +08:00
|
|
|
|
2014-02-12 11:21:20 +08:00
|
|
|
void ScanLibDirForGCCTriple(const llvm::Triple &TargetArch,
|
2013-06-17 21:59:19 +08:00
|
|
|
const llvm::opt::ArgList &Args,
|
2011-11-09 11:46:20 +08:00
|
|
|
const std::string &LibDir,
|
Make a major refactoring to how the GCC installation detection works.
The fundamental shift here is to stop making *any* assumptions about the
*host* triple. Where these assumptions you ask? Why, they were in one of
the two target triples referenced of course. This was the single biggest
place where the previously named "host triple" was actually used as
such. ;] The reason we were reasoning about the host is in order to
detect the use of '-m32' or '-m64' flags to change the target. These
flags shift the default target only slightly, which typically means
a slight deviation from the host. When using these flags, the GCC
installation is under a different triple from the one actually targeted
in the compilation, and we used the host triple to find it.
Too bad that wasn't even correct. Consider an x86 Linux host which has
a PPC64 cross-compiling GCC toolchain installed. This toolchain is also
configured for multiarch compiling and can target PPC32 with eth '-m32'
flag. When targeting 'powerpc-linux-gnu' or some other PPC32 triple, we
have to look for the PPC64 variant of the triple to find the GCC
install, and that triple is neither the host nor target.
The new logic computes the multiarch's alternate triple from the target
triple, and looks under both sides. It also looks more aggressively for
the correct subdirectory of the GCC installation, and exposes the
subdirectory in a nice programmatic way. This '/32' or '/64' suffix is
something we can reuse in many other parts of the toolchain.
An important note -- while this likely fixes a large category of
cross-compile use cases, that's not my primary goal, and I've not done
testing (or added test cases) for scenarios that may now work. If
someone else wants to try more interesting PPC cross compiles, I'd love
to have reports. But my focus is on factoring away the references to the
"host" triple. The refactoring is my goal, and so I'm mostly relying on
the existing (pretty good) test coverage we have here.
Future patches will leverage this new functionality to factor out more
and more of the toolchain's triple manipulation.
llvm-svn: 148935
2012-01-25 15:21:38 +08:00
|
|
|
StringRef CandidateTriple,
|
2013-06-22 19:35:51 +08:00
|
|
|
bool NeedsBiarchSuffix = false);
|
2013-10-10 15:57:44 +08:00
|
|
|
|
2014-02-12 11:21:20 +08:00
|
|
|
bool findMIPSMultilibs(const llvm::Triple &TargetArch, StringRef Path,
|
|
|
|
const llvm::opt::ArgList &Args);
|
|
|
|
|
|
|
|
bool findBiarchMultilibs(const llvm::Triple &TargetArch, StringRef Path,
|
|
|
|
const llvm::opt::ArgList &Args,
|
|
|
|
bool NeedsBiarchSuffix);
|
2011-11-07 07:39:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
GCCInstallationDetector GCCInstallation;
|
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Generic_GCC(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2009-03-20 08:20:03 +08:00
|
|
|
~Generic_GCC();
|
2009-03-18 05:38:00 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void printVerboseInfo(raw_ostream &OS) const override;
|
2013-07-31 01:57:09 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsUnwindTablesDefault() const override;
|
|
|
|
bool isPICDefault() const override;
|
|
|
|
bool isPIEDefault() const override;
|
|
|
|
bool isPICDefaultForced() const override;
|
|
|
|
bool IsIntegratedAssemblerDefault() const override;
|
2011-11-07 07:39:37 +08:00
|
|
|
|
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *getTool(Action::ActionClass AC) const override;
|
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2013-03-20 11:05:54 +08:00
|
|
|
|
2011-11-07 07:39:37 +08:00
|
|
|
/// \name ToolChain Implementation Helper Functions
|
|
|
|
/// @{
|
|
|
|
|
|
|
|
/// \brief Check whether the target triple's architecture is 64-bits.
|
2012-02-11 11:31:12 +08:00
|
|
|
bool isTarget64Bit() const { return getTriple().isArch64Bit(); }
|
|
|
|
|
2011-11-07 07:39:37 +08:00
|
|
|
/// \brief Check whether the target triple's architecture is 32-bits.
|
2012-02-11 11:31:12 +08:00
|
|
|
bool isTarget32Bit() const { return getTriple().isArch32Bit(); }
|
2011-11-07 07:39:37 +08:00
|
|
|
|
|
|
|
/// @}
|
2013-03-20 11:05:54 +08:00
|
|
|
|
|
|
|
private:
|
2014-03-08 04:03:18 +08:00
|
|
|
mutable std::unique_ptr<tools::gcc::Preprocess> Preprocess;
|
|
|
|
mutable std::unique_ptr<tools::gcc::Compile> Compile;
|
2009-03-18 05:38:00 +08:00
|
|
|
};
|
|
|
|
|
2014-01-16 16:48:16 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
|
|
|
Tool *getTool(Action::ActionClass AC) const override;
|
2010-08-02 13:44:07 +08:00
|
|
|
private:
|
2014-03-08 04:03:18 +08:00
|
|
|
mutable std::unique_ptr<tools::darwin::Lipo> Lipo;
|
|
|
|
mutable std::unique_ptr<tools::darwin::Dsymutil> Dsymutil;
|
|
|
|
mutable std::unique_ptr<tools::darwin::VerifyDebug> VerifyDebug;
|
2013-03-20 11:05:54 +08:00
|
|
|
|
2014-01-16 16:48:16 +08:00
|
|
|
public:
|
|
|
|
MachO(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
|
|
|
~MachO();
|
|
|
|
|
|
|
|
/// @name MachO specific toolchain API
|
|
|
|
/// {
|
|
|
|
|
|
|
|
/// Get the "MachO" arch name for a particular compiler invocation. For
|
|
|
|
/// example, Apple treats different ARM variations as distinct architectures.
|
|
|
|
StringRef getMachOArchName(const llvm::opt::ArgList &Args) const;
|
|
|
|
|
|
|
|
|
|
|
|
/// Add the linker arguments to link the ARC runtime library.
|
|
|
|
virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs) const {}
|
|
|
|
|
|
|
|
/// Add the linker arguments to link the compiler runtime library.
|
|
|
|
virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs) const;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
addStartObjectFileArgs(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs) const {}
|
|
|
|
|
|
|
|
virtual void addMinVersionArgs(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs) const {}
|
|
|
|
|
|
|
|
/// On some iOS platforms, kernel and kernel modules were built statically. Is
|
|
|
|
/// this such a target?
|
|
|
|
virtual bool isKernelStatic() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Is the target either iOS or an iOS simulator?
|
|
|
|
bool isTargetIOSBased() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddLinkRuntimeLib(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs,
|
|
|
|
StringRef DarwinStaticLib,
|
|
|
|
bool AlwaysLink = false,
|
|
|
|
bool IsEmbedded = false) const;
|
|
|
|
|
|
|
|
/// }
|
|
|
|
/// @name ToolChain Implementation
|
|
|
|
/// {
|
|
|
|
|
|
|
|
std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
|
2014-03-14 14:02:07 +08:00
|
|
|
types::ID InputType) const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
types::ID LookupTypeForExtension(const char *Ext) const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool HasNativeLLVMSupport() const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::DerivedArgList *
|
2014-01-16 16:48:16 +08:00
|
|
|
TranslateArgs(const llvm::opt::DerivedArgList &Args,
|
2014-03-14 14:02:07 +08:00
|
|
|
const char *BoundArch) const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsBlocksDefault() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
// Always allow blocks on Apple; users interested in versioning are
|
|
|
|
// expected to use /usr/include/Blocks.h.
|
|
|
|
return true;
|
|
|
|
}
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsIntegratedAssemblerDefault() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
// Default integrated assembler to on for Apple's MachO targets.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsMathErrnoDefault() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsEncodeExtendedBlockSignatureDefault() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsObjCNonFragileABIDefault() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
// Non-fragile ABI is default for everything but i386.
|
|
|
|
return getTriple().getArch() != llvm::Triple::x86;
|
|
|
|
}
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool UseObjCMixedDispatch() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsUnwindTablesDefault() const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
RuntimeLibType GetDefaultRuntimeLibType() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
return ToolChain::RLT_CompilerRT;
|
|
|
|
}
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool isPICDefault() const override;
|
|
|
|
bool isPIEDefault() const override;
|
|
|
|
bool isPICDefaultForced() const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool SupportsProfiling() const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool SupportsObjCGC() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool UseDwarfDebugFlags() const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool UseSjLjExceptions() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// }
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Darwin - The base Darwin tool chain.
|
|
|
|
class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
|
|
|
|
public:
|
|
|
|
/// The host version.
|
|
|
|
unsigned DarwinVersion[3];
|
|
|
|
|
2010-01-27 08:56:25 +08:00
|
|
|
/// Whether the information on the target has been initialized.
|
|
|
|
//
|
|
|
|
// FIXME: This should be eliminated. What we want to do is make this part of
|
|
|
|
// the "default target for arguments" selection process, once we get out of
|
|
|
|
// the argument translation business.
|
|
|
|
mutable bool TargetInitialized;
|
|
|
|
|
2013-12-12 19:55:52 +08:00
|
|
|
enum DarwinPlatformKind {
|
|
|
|
MacOS,
|
|
|
|
IPhoneOS,
|
2014-01-16 16:48:16 +08:00
|
|
|
IPhoneOSSimulator
|
2013-12-12 19:55:52 +08:00
|
|
|
};
|
2010-05-14 10:03:00 +08:00
|
|
|
|
2013-12-12 19:55:52 +08:00
|
|
|
mutable DarwinPlatformKind TargetPlatform;
|
2011-04-30 12:18:16 +08:00
|
|
|
|
2011-04-15 13:22:18 +08:00
|
|
|
/// The OS version we are targeting.
|
2012-03-11 04:55:36 +08:00
|
|
|
mutable VersionTuple TargetVersion;
|
2010-01-27 08:56:25 +08:00
|
|
|
|
2012-06-20 14:18:46 +08:00
|
|
|
private:
|
2009-03-27 00:23:12 +08:00
|
|
|
/// The default macosx-version-min of this tool chain; empty until
|
|
|
|
/// initialized.
|
2010-01-26 09:45:19 +08:00
|
|
|
std::string MacosxVersionMin;
|
2009-03-27 00:23:12 +08:00
|
|
|
|
2012-05-10 02:37:26 +08:00
|
|
|
/// The default ios-version-min of this tool chain; empty until
|
|
|
|
/// initialized.
|
|
|
|
std::string iOSVersionMin;
|
|
|
|
|
2010-07-20 01:11:33 +08:00
|
|
|
private:
|
2013-06-17 21:59:19 +08:00
|
|
|
void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const;
|
2010-07-20 01:11:33 +08:00
|
|
|
|
2009-03-20 08:57:52 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Darwin(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2009-09-05 02:34:51 +08:00
|
|
|
~Darwin();
|
2009-03-20 08:57:52 +08:00
|
|
|
|
2013-06-17 21:59:19 +08:00
|
|
|
std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
|
2014-03-14 14:02:07 +08:00
|
|
|
types::ID InputType) const override;
|
2010-08-24 06:35:37 +08:00
|
|
|
|
2014-01-16 16:48:16 +08:00
|
|
|
/// @name Apple Specific Toolchain Implementation
|
|
|
|
/// {
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2014-01-16 16:48:16 +08:00
|
|
|
addMinVersionArgs(const llvm::opt::ArgList &Args,
|
2014-03-02 17:32:10 +08:00
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2014-01-16 16:48:16 +08:00
|
|
|
addStartObjectFileArgs(const llvm::opt::ArgList &Args,
|
2014-03-02 17:32:10 +08:00
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool isKernelStatic() const override {
|
2014-01-16 16:48:16 +08:00
|
|
|
return !isTargetIPhoneOS() || isIPhoneOSVersionLT(6, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/// }
|
|
|
|
/// @name Darwin specific Toolchain functions
|
2009-09-18 16:14:36 +08:00
|
|
|
/// {
|
|
|
|
|
2010-01-27 08:56:25 +08:00
|
|
|
// FIXME: Eliminate these ...Target functions and derive separate tool chains
|
|
|
|
// for these targets and put version in constructor.
|
2013-12-12 19:55:52 +08:00
|
|
|
void setTarget(DarwinPlatformKind Platform, unsigned Major, unsigned Minor,
|
|
|
|
unsigned Micro) const {
|
2010-01-27 08:56:25 +08:00
|
|
|
// FIXME: For now, allow reinitialization as long as values don't
|
|
|
|
// change. This will go away when we move away from argument translation.
|
2013-12-12 19:55:52 +08:00
|
|
|
if (TargetInitialized && TargetPlatform == Platform &&
|
2012-03-11 04:55:36 +08:00
|
|
|
TargetVersion == VersionTuple(Major, Minor, Micro))
|
2010-01-27 08:56:25 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
assert(!TargetInitialized && "Target already initialized!");
|
|
|
|
TargetInitialized = true;
|
2013-12-12 19:55:52 +08:00
|
|
|
TargetPlatform = Platform;
|
2012-03-11 04:55:36 +08:00
|
|
|
TargetVersion = VersionTuple(Major, Minor, Micro);
|
2010-01-27 08:56:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool isTargetIPhoneOS() const {
|
|
|
|
assert(TargetInitialized && "Target not initialized!");
|
2013-12-12 19:55:52 +08:00
|
|
|
return TargetPlatform == IPhoneOS;
|
2010-01-27 08:56:25 +08:00
|
|
|
}
|
|
|
|
|
2011-04-01 01:12:33 +08:00
|
|
|
bool isTargetIOSSimulator() const {
|
2011-04-30 12:18:16 +08:00
|
|
|
assert(TargetInitialized && "Target not initialized!");
|
2013-12-12 19:55:52 +08:00
|
|
|
return TargetPlatform == IPhoneOSSimulator;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isTargetIOSBased() const {
|
|
|
|
assert(TargetInitialized && "Target not initialized!");
|
|
|
|
return isTargetIPhoneOS() || isTargetIOSSimulator();
|
2011-04-01 01:12:33 +08:00
|
|
|
}
|
|
|
|
|
2012-03-07 04:05:56 +08:00
|
|
|
bool isTargetMacOS() const {
|
2013-12-12 19:55:52 +08:00
|
|
|
return TargetPlatform == MacOS;
|
|
|
|
}
|
|
|
|
|
2010-03-20 08:50:21 +08:00
|
|
|
bool isTargetInitialized() const { return TargetInitialized; }
|
|
|
|
|
2012-03-11 04:55:36 +08:00
|
|
|
VersionTuple getTargetVersion() const {
|
2010-01-27 08:56:25 +08:00
|
|
|
assert(TargetInitialized && "Target not initialized!");
|
2012-03-11 04:55:36 +08:00
|
|
|
return TargetVersion;
|
2010-01-27 08:56:25 +08:00
|
|
|
}
|
|
|
|
|
2010-01-27 08:57:03 +08:00
|
|
|
bool isIPhoneOSVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const {
|
2013-12-12 19:55:52 +08:00
|
|
|
assert(isTargetIOSBased() && "Unexpected call for non iOS target!");
|
2012-03-11 04:55:36 +08:00
|
|
|
return TargetVersion < VersionTuple(V0, V1, V2);
|
2009-09-18 16:14:55 +08:00
|
|
|
}
|
|
|
|
|
2010-01-27 08:57:03 +08:00
|
|
|
bool isMacosxVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const {
|
2013-12-12 19:55:52 +08:00
|
|
|
assert(isTargetMacOS() && "Unexpected call for non OS X target!");
|
2012-03-11 04:55:36 +08:00
|
|
|
return TargetVersion < VersionTuple(V0, V1, V2);
|
2010-01-27 08:56:56 +08:00
|
|
|
}
|
|
|
|
|
2014-01-16 16:48:16 +08:00
|
|
|
public:
|
2009-09-18 16:14:36 +08:00
|
|
|
/// }
|
|
|
|
/// @name ToolChain Implementation
|
|
|
|
/// {
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::DerivedArgList *
|
2013-06-17 21:59:19 +08:00
|
|
|
TranslateArgs(const llvm::opt::DerivedArgList &Args,
|
2014-03-14 14:02:07 +08:00
|
|
|
const char *BoundArch) const override;
|
2009-03-20 08:57:52 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const override;
|
|
|
|
bool hasBlocksRuntime() const override;
|
2010-04-25 02:37:41 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool UseObjCMixedDispatch() const override {
|
2010-04-25 02:37:41 +08:00
|
|
|
// This is only used with the non-fragile ABI and non-legacy dispatch.
|
|
|
|
|
|
|
|
// Mixed dispatch is used everywhere except OS X before 10.6.
|
2013-12-12 19:55:52 +08:00
|
|
|
return !(isTargetMacOS() && isMacosxVersionLT(10, 6));
|
2010-04-25 01:56:46 +08:00
|
|
|
}
|
2014-01-16 16:48:16 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
|
2011-08-23 15:38:27 +08:00
|
|
|
// Stack protectors default to on for user code on 10.5,
|
|
|
|
// and for everything in 10.6 and beyond
|
2013-12-12 19:55:52 +08:00
|
|
|
if (isTargetIOSBased())
|
|
|
|
return 1;
|
|
|
|
else if (isTargetMacOS() && !isMacosxVersionLT(10, 6))
|
|
|
|
return 1;
|
|
|
|
else if (isTargetMacOS() && !isMacosxVersionLT(10, 5) && !KernelOrKext)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
2009-11-17 16:07:36 +08:00
|
|
|
}
|
2011-03-02 02:49:30 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool SupportsObjCGC() const override;
|
2010-04-11 00:20:23 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void CheckObjCARC() const override;
|
2012-02-29 11:43:52 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool UseSjLjExceptions() const override;
|
2009-03-20 08:57:52 +08:00
|
|
|
};
|
|
|
|
|
2009-09-18 16:15:13 +08:00
|
|
|
/// DarwinClang - The Darwin toolchain used by Clang.
|
2010-05-12 04:16:05 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
|
2009-09-18 16:15:13 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
DarwinClang(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2009-09-18 16:15:13 +08:00
|
|
|
|
2014-01-16 16:48:16 +08:00
|
|
|
/// @name Apple ToolChain Implementation
|
2009-09-18 16:15:13 +08:00
|
|
|
/// {
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2014-01-16 16:48:16 +08:00
|
|
|
AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
|
2014-03-02 17:32:10 +08:00
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2012-11-21 22:17:42 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2014-01-16 16:48:16 +08:00
|
|
|
AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
|
2014-03-02 17:32:10 +08:00
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2010-09-17 09:16:06 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2014-01-16 16:48:16 +08:00
|
|
|
AddCCKextLibArgs(const llvm::opt::ArgList &Args,
|
2014-03-02 17:32:10 +08:00
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2010-09-18 02:39:08 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2014-01-16 16:48:16 +08:00
|
|
|
AddLinkARCArgs(const llvm::opt::ArgList &Args,
|
2014-03-02 17:32:10 +08:00
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2009-09-18 16:15:13 +08:00
|
|
|
/// }
|
|
|
|
};
|
|
|
|
|
2010-10-30 04:14:02 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Generic_ELF : public Generic_GCC {
|
2011-12-20 10:48:34 +08:00
|
|
|
virtual void anchor();
|
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Generic_ELF(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args)
|
|
|
|
: Generic_GCC(D, Triple, Args) {}
|
2014-01-10 21:44:34 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
2010-10-30 04:14:02 +08:00
|
|
|
};
|
|
|
|
|
2010-05-12 04:16:05 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY AuroraUX : public Generic_GCC {
|
2009-08-22 09:06:46 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
AuroraUX(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2009-08-22 09:06:46 +08:00
|
|
|
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2009-08-22 09:06:46 +08:00
|
|
|
};
|
|
|
|
|
2012-02-15 21:39:01 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_GCC {
|
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Solaris(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2012-02-15 21:39:01 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsIntegratedAssemblerDefault() const override { return true; }
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2013-03-20 11:05:54 +08:00
|
|
|
|
2012-02-15 21:39:01 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-10-30 04:14:02 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
|
2009-06-30 04:52:51 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
OpenBSD(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2009-06-30 04:52:51 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsMathErrnoDefault() const override { return false; }
|
|
|
|
bool IsObjCNonFragileABIDefault() const override { return true; }
|
|
|
|
bool isPIEDefault() const override { return true; }
|
2013-06-05 12:28:55 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
|
2013-06-05 12:28:55 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2012-04-09 20:33:41 +08:00
|
|
|
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2009-06-30 04:52:51 +08:00
|
|
|
};
|
|
|
|
|
2012-08-09 07:57:20 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Bitrig : public Generic_ELF {
|
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Bitrig(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2012-08-09 07:57:20 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsMathErrnoDefault() const override { return false; }
|
|
|
|
bool IsObjCNonFragileABIDefault() const override { return true; }
|
2012-08-09 07:57:20 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
|
|
|
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
|
2012-08-09 07:57:20 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2013-03-20 11:05:54 +08:00
|
|
|
|
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2012-08-09 07:57:20 +08:00
|
|
|
};
|
|
|
|
|
2010-10-30 04:14:02 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
|
2009-03-31 05:06:03 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
FreeBSD(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2014-03-14 14:02:07 +08:00
|
|
|
bool HasNativeLLVMSupport() const override;
|
2009-03-31 05:06:03 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsMathErrnoDefault() const override { return false; }
|
|
|
|
bool IsObjCNonFragileABIDefault() const override { return true; }
|
2012-04-09 20:33:41 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
|
|
|
|
void
|
2013-11-09 23:10:56 +08:00
|
|
|
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
bool IsIntegratedAssemblerDefault() const override {
|
2013-12-18 04:34:25 +08:00
|
|
|
if (getTriple().getArch() == llvm::Triple::ppc ||
|
|
|
|
getTriple().getArch() == llvm::Triple::ppc64)
|
|
|
|
return true;
|
|
|
|
return Generic_ELF::IsIntegratedAssemblerDefault();
|
|
|
|
}
|
2013-11-09 23:10:56 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool UseSjLjExceptions() const override;
|
|
|
|
bool isPIEDefault() const override;
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2009-03-31 05:06:03 +08:00
|
|
|
};
|
|
|
|
|
2011-02-03 02:59:27 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
|
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
NetBSD(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2011-02-03 02:59:27 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsMathErrnoDefault() const override { return false; }
|
|
|
|
bool IsObjCNonFragileABIDefault() const override { return true; }
|
2012-04-09 20:33:41 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
|
2013-04-30 09:21:43 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
bool IsUnwindTablesDefault() const override {
|
2013-08-15 23:08:33 +08:00
|
|
|
return true;
|
|
|
|
}
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsIntegratedAssemblerDefault() const override {
|
2013-08-15 23:04:56 +08:00
|
|
|
if (getTriple().getArch() == llvm::Triple::ppc)
|
|
|
|
return true;
|
|
|
|
return Generic_ELF::IsIntegratedAssemblerDefault();
|
|
|
|
}
|
2013-04-30 09:21:43 +08:00
|
|
|
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2011-02-03 02:59:27 +08:00
|
|
|
};
|
|
|
|
|
2011-12-09 07:54:21 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Minix : public Generic_ELF {
|
2010-07-08 00:01:42 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Minix(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2010-07-08 00:01:42 +08:00
|
|
|
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2010-07-08 00:01:42 +08:00
|
|
|
};
|
|
|
|
|
2010-10-30 04:14:02 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY DragonFly : public Generic_ELF {
|
2009-05-03 02:28:39 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
DragonFly(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2009-05-03 02:28:39 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsMathErrnoDefault() const override { return false; }
|
2012-05-02 22:55:48 +08:00
|
|
|
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2009-05-03 02:28:39 +08:00
|
|
|
};
|
|
|
|
|
2010-10-30 04:14:02 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
|
2009-05-26 15:52:18 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Linux(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2010-08-10 08:25:48 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool HasNativeLLVMSupport() const override;
|
2010-11-08 04:14:31 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
bool isPIEDefault() const override;
|
2011-11-06 04:17:13 +08:00
|
|
|
|
2010-11-08 04:14:31 +08:00
|
|
|
std::string Linker;
|
|
|
|
std::vector<std::string> ExtraOpts;
|
2011-12-18 07:10:01 +08:00
|
|
|
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2013-03-20 11:05:54 +08:00
|
|
|
|
2011-12-18 07:10:01 +08:00
|
|
|
private:
|
2013-03-07 01:14:05 +08:00
|
|
|
static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
|
2014-02-12 11:21:20 +08:00
|
|
|
Twine TargetArchDir, Twine IncludeSuffix,
|
2013-06-17 21:59:19 +08:00
|
|
|
const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args);
|
2011-12-18 07:10:01 +08:00
|
|
|
static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
|
2013-06-17 21:59:19 +08:00
|
|
|
const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args);
|
2013-04-20 16:15:03 +08:00
|
|
|
|
2013-10-05 22:37:55 +08:00
|
|
|
std::string computeSysRoot() const;
|
2009-05-26 15:52:18 +08:00
|
|
|
};
|
|
|
|
|
2012-12-06 20:43:18 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Hexagon_TC : public Linux {
|
|
|
|
protected:
|
|
|
|
GCCVersion GCCLibAndIncVersion;
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2012-12-06 20:43:18 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
Hexagon_TC(const Driver &D, const llvm::Triple &Triple,
|
2013-06-17 21:59:19 +08:00
|
|
|
const llvm::opt::ArgList &Args);
|
2012-12-06 20:43:18 +08:00
|
|
|
~Hexagon_TC();
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
|
2012-12-06 20:43:18 +08:00
|
|
|
|
|
|
|
StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
|
|
|
|
|
|
|
|
static std::string GetGnuDir(const std::string &InstalledDir);
|
2012-12-06 22:16:43 +08:00
|
|
|
|
2013-06-17 21:59:19 +08:00
|
|
|
static StringRef GetTargetCPU(const llvm::opt::ArgList &Args);
|
2012-12-06 20:43:18 +08:00
|
|
|
};
|
2009-05-26 15:52:18 +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.
|
2010-05-12 04:16:05 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY TCEToolChain : public ToolChain {
|
2010-03-05 05:07:38 +08:00
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
TCEToolChain(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2010-03-05 05:07:38 +08:00
|
|
|
~TCEToolChain();
|
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsMathErrnoDefault() const override;
|
|
|
|
bool isPICDefault() const override;
|
|
|
|
bool isPIEDefault() const override;
|
|
|
|
bool isPICDefaultForced() const override;
|
2010-03-05 05:07:38 +08:00
|
|
|
};
|
|
|
|
|
2010-08-22 05:55:07 +08:00
|
|
|
class LLVM_LIBRARY_VISIBILITY Windows : public ToolChain {
|
|
|
|
public:
|
2013-06-17 21:59:19 +08:00
|
|
|
Windows(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
2010-08-22 05:55:07 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
bool IsIntegratedAssemblerDefault() const override;
|
|
|
|
bool IsUnwindTablesDefault() const override;
|
|
|
|
bool isPICDefault() const override;
|
|
|
|
bool isPIEDefault() const override;
|
|
|
|
bool isPICDefaultForced() const override;
|
2011-11-05 07:49:05 +08:00
|
|
|
|
2014-03-14 14:02:07 +08:00
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void
|
2013-06-17 21:59:19 +08:00
|
|
|
AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
2014-03-14 14:02:07 +08:00
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
2013-06-17 21:59:19 +08:00
|
|
|
|
2013-03-20 11:05:54 +08:00
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildLinker() const override;
|
|
|
|
Tool *buildAssembler() const override;
|
2010-08-22 05:55:07 +08:00
|
|
|
};
|
|
|
|
|
2013-10-11 18:29:40 +08:00
|
|
|
|
|
|
|
class LLVM_LIBRARY_VISIBILITY XCore : public ToolChain {
|
|
|
|
public:
|
|
|
|
XCore(const Driver &D, const llvm::Triple &Triple,
|
|
|
|
const llvm::opt::ArgList &Args);
|
|
|
|
protected:
|
2014-03-14 14:02:07 +08:00
|
|
|
Tool *buildAssembler() const override;
|
|
|
|
Tool *buildLinker() const override;
|
2013-10-11 18:29:40 +08:00
|
|
|
public:
|
2014-03-14 14:02:07 +08:00
|
|
|
bool isPICDefault() const override;
|
|
|
|
bool isPIEDefault() const override;
|
|
|
|
bool isPICDefaultForced() const override;
|
|
|
|
bool SupportsProfiling() const override;
|
|
|
|
bool hasBlocksRuntime() const override;
|
|
|
|
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
|
|
|
llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
|
|
|
|
llvm::opt::ArgStringList &CmdArgs) const override;
|
2013-10-11 18:29:40 +08:00
|
|
|
};
|
|
|
|
|
2009-03-18 05:38:00 +08:00
|
|
|
} // end namespace toolchains
|
|
|
|
} // end namespace driver
|
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif
|