1 //===--- ToolChains.h - ToolChain Implementations ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_H
14 #include "clang/Basic/VersionTuple.h"
15 #include "clang/Driver/Action.h"
16 #include "clang/Driver/Multilib.h"
17 #include "clang/Driver/ToolChain.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/Optional.h"
20 #include "llvm/Support/Compiler.h"
26 namespace toolchains
{
28 /// Generic_GCC - A tool chain using the 'gcc' command to perform
29 /// all subcommands; this relies on gcc translating the majority of
30 /// command line options.
31 class LLVM_LIBRARY_VISIBILITY Generic_GCC
: public ToolChain
{
33 /// \brief Struct to store and manipulate GCC versions.
35 /// We rely on assumptions about the form and structure of GCC version
36 /// numbers: they consist of at most three '.'-separated components, and each
37 /// component is a non-negative integer except for the last component. For
38 /// the last component we are very flexible in order to tolerate release
39 /// candidates or 'x' wildcards.
41 /// Note that the ordering established among GCCVersions is based on the
42 /// preferred version string to use. For example we prefer versions without
43 /// a hard-coded patch number to those with a hard coded patch number.
45 /// Currently this doesn't provide any logic for textual suffixes to patches
46 /// in the way that (for example) Debian's version format does. If that ever
47 /// becomes necessary, it can be added.
49 /// \brief The unparsed text of the version.
52 /// \brief The parsed major, minor, and patch numbers.
53 int Major
, Minor
, Patch
;
55 /// \brief The text of the parsed major, and major+minor versions.
56 std::string MajorStr
, MinorStr
;
58 /// \brief Any textual suffix on the patch number.
59 std::string PatchSuffix
;
61 static GCCVersion
Parse(StringRef VersionText
);
62 bool isOlderThan(int RHSMajor
, int RHSMinor
, int RHSPatch
,
63 StringRef RHSPatchSuffix
= StringRef()) const;
64 bool operator<(const GCCVersion
&RHS
) const {
65 return isOlderThan(RHS
.Major
, RHS
.Minor
, RHS
.Patch
, RHS
.PatchSuffix
);
67 bool operator>(const GCCVersion
&RHS
) const { return RHS
< *this; }
68 bool operator<=(const GCCVersion
&RHS
) const { return !(*this > RHS
); }
69 bool operator>=(const GCCVersion
&RHS
) const { return !(*this < RHS
); }
72 /// \brief This is a class to find a viable GCC installation for Clang to
75 /// This class tries to find a GCC installation on the system, and report
76 /// information about it. It starts from the host information provided to the
77 /// Driver, and has logic for fuzzing that where appropriate.
78 class GCCInstallationDetector
{
80 llvm::Triple GCCTriple
;
82 // FIXME: These might be better as path objects.
83 std::string GCCInstallPath
;
84 std::string GCCParentLibPath
;
86 /// The primary multilib appropriate for the given flags.
87 Multilib SelectedMultilib
;
88 /// On Biarch systems, this corresponds to the default multilib when
89 /// targeting the non-default multilib. Otherwise, it is empty.
90 llvm::Optional
<Multilib
> BiarchSibling
;
94 // We retain the list of install paths that were considered and rejected in
95 // order to print out detailed information in verbose mode.
96 std::set
<std::string
> CandidateGCCInstallPaths
;
98 /// The set of multilibs that the detected installation supports.
99 MultilibSet Multilibs
;
102 GCCInstallationDetector() : IsValid(false) {}
103 void init(const Driver
&D
, const llvm::Triple
&TargetTriple
,
104 const llvm::opt::ArgList
&Args
);
106 /// \brief Check whether we detected a valid GCC install.
107 bool isValid() const { return IsValid
; }
109 /// \brief Get the GCC triple for the detected install.
110 const llvm::Triple
&getTriple() const { return GCCTriple
; }
112 /// \brief Get the detected GCC installation path.
113 StringRef
getInstallPath() const { return GCCInstallPath
; }
115 /// \brief Get the detected GCC parent lib path.
116 StringRef
getParentLibPath() const { return GCCParentLibPath
; }
118 /// \brief Get the detected Multilib
119 const Multilib
&getMultilib() const { return SelectedMultilib
; }
121 /// \brief Get the whole MultilibSet
122 const MultilibSet
&getMultilibs() const { return Multilibs
; }
124 /// Get the biarch sibling multilib (if it exists).
125 /// \return true iff such a sibling exists
126 bool getBiarchSibling(Multilib
&M
) const;
128 /// \brief Get the detected GCC version string.
129 const GCCVersion
&getVersion() const { return Version
; }
131 /// \brief Print information about the detected GCC installation.
132 void print(raw_ostream
&OS
) const;
136 CollectLibDirsAndTriples(const llvm::Triple
&TargetTriple
,
137 const llvm::Triple
&BiarchTriple
,
138 SmallVectorImpl
<StringRef
> &LibDirs
,
139 SmallVectorImpl
<StringRef
> &TripleAliases
,
140 SmallVectorImpl
<StringRef
> &BiarchLibDirs
,
141 SmallVectorImpl
<StringRef
> &BiarchTripleAliases
);
143 void ScanLibDirForGCCTriple(const llvm::Triple
&TargetArch
,
144 const llvm::opt::ArgList
&Args
,
145 const std::string
&LibDir
,
146 StringRef CandidateTriple
,
147 bool NeedsBiarchSuffix
= false);
150 GCCInstallationDetector GCCInstallation
;
153 Generic_GCC(const Driver
&D
, const llvm::Triple
&Triple
,
154 const llvm::opt::ArgList
&Args
);
157 void printVerboseInfo(raw_ostream
&OS
) const override
;
159 bool IsUnwindTablesDefault() const override
;
160 bool isPICDefault() const override
;
161 bool isPIEDefault() const override
;
162 bool isPICDefaultForced() const override
;
163 bool IsIntegratedAssemblerDefault() const override
;
166 Tool
*getTool(Action::ActionClass AC
) const override
;
167 Tool
*buildAssembler() const override
;
168 Tool
*buildLinker() const override
;
170 /// \name ToolChain Implementation Helper Functions
173 /// \brief Check whether the target triple's architecture is 64-bits.
174 bool isTarget64Bit() const { return getTriple().isArch64Bit(); }
176 /// \brief Check whether the target triple's architecture is 32-bits.
177 bool isTarget32Bit() const { return getTriple().isArch32Bit(); }
182 mutable std::unique_ptr
<tools::gcc::Preprocess
> Preprocess
;
183 mutable std::unique_ptr
<tools::gcc::Compile
> Compile
;
186 class LLVM_LIBRARY_VISIBILITY MachO
: public ToolChain
{
188 Tool
*buildAssembler() const override
;
189 Tool
*buildLinker() const override
;
190 Tool
*getTool(Action::ActionClass AC
) const override
;
192 mutable std::unique_ptr
<tools::darwin::Lipo
> Lipo
;
193 mutable std::unique_ptr
<tools::darwin::Dsymutil
> Dsymutil
;
194 mutable std::unique_ptr
<tools::darwin::VerifyDebug
> VerifyDebug
;
197 MachO(const Driver
&D
, const llvm::Triple
&Triple
,
198 const llvm::opt::ArgList
&Args
);
201 /// @name MachO specific toolchain API
204 /// Get the "MachO" arch name for a particular compiler invocation. For
205 /// example, Apple treats different ARM variations as distinct architectures.
206 StringRef
getMachOArchName(const llvm::opt::ArgList
&Args
) const;
209 /// Add the linker arguments to link the ARC runtime library.
210 virtual void AddLinkARCArgs(const llvm::opt::ArgList
&Args
,
211 llvm::opt::ArgStringList
&CmdArgs
) const {}
213 /// Add the linker arguments to link the compiler runtime library.
214 virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList
&Args
,
215 llvm::opt::ArgStringList
&CmdArgs
) const;
218 addStartObjectFileArgs(const llvm::opt::ArgList
&Args
,
219 llvm::opt::ArgStringList
&CmdArgs
) const {}
221 virtual void addMinVersionArgs(const llvm::opt::ArgList
&Args
,
222 llvm::opt::ArgStringList
&CmdArgs
) const {}
224 /// On some iOS platforms, kernel and kernel modules were built statically. Is
225 /// this such a target?
226 virtual bool isKernelStatic() const {
230 /// Is the target either iOS or an iOS simulator?
231 bool isTargetIOSBased() const {
235 void AddLinkRuntimeLib(const llvm::opt::ArgList
&Args
,
236 llvm::opt::ArgStringList
&CmdArgs
,
237 StringRef DarwinLibName
,
238 bool AlwaysLink
= false,
239 bool IsEmbedded
= false,
240 bool AddRPath
= false) const;
243 /// @name ToolChain Implementation
246 std::string
ComputeEffectiveClangTriple(const llvm::opt::ArgList
&Args
,
247 types::ID InputType
) const override
;
249 types::ID
LookupTypeForExtension(const char *Ext
) const override
;
251 bool HasNativeLLVMSupport() const override
;
253 llvm::opt::DerivedArgList
*
254 TranslateArgs(const llvm::opt::DerivedArgList
&Args
,
255 const char *BoundArch
) const override
;
257 bool IsBlocksDefault() const override
{
258 // Always allow blocks on Apple; users interested in versioning are
259 // expected to use /usr/include/Block.h.
262 bool IsIntegratedAssemblerDefault() const override
{
263 // Default integrated assembler to on for Apple's MachO targets.
267 bool IsMathErrnoDefault() const override
{
271 bool IsEncodeExtendedBlockSignatureDefault() const override
{
275 bool IsObjCNonFragileABIDefault() const override
{
276 // Non-fragile ABI is default for everything but i386.
277 return getTriple().getArch() != llvm::Triple::x86
;
280 bool UseObjCMixedDispatch() const override
{
284 bool IsUnwindTablesDefault() const override
;
286 RuntimeLibType
GetDefaultRuntimeLibType() const override
{
287 return ToolChain::RLT_CompilerRT
;
290 bool isPICDefault() const override
;
291 bool isPIEDefault() const override
;
292 bool isPICDefaultForced() const override
;
294 bool SupportsProfiling() const override
;
296 bool SupportsObjCGC() const override
{
300 bool UseDwarfDebugFlags() const override
;
302 bool UseSjLjExceptions() const override
{
309 /// Darwin - The base Darwin tool chain.
310 class LLVM_LIBRARY_VISIBILITY Darwin
: public MachO
{
312 /// The host version.
313 unsigned DarwinVersion
[3];
315 /// Whether the information on the target has been initialized.
317 // FIXME: This should be eliminated. What we want to do is make this part of
318 // the "default target for arguments" selection process, once we get out of
319 // the argument translation business.
320 mutable bool TargetInitialized
;
322 enum DarwinPlatformKind
{
328 mutable DarwinPlatformKind TargetPlatform
;
330 /// The OS version we are targeting.
331 mutable VersionTuple TargetVersion
;
334 /// The default macosx-version-min of this tool chain; empty until
336 std::string MacosxVersionMin
;
338 /// The default ios-version-min of this tool chain; empty until
340 std::string iOSVersionMin
;
343 void AddDeploymentTarget(llvm::opt::DerivedArgList
&Args
) const;
346 Darwin(const Driver
&D
, const llvm::Triple
&Triple
,
347 const llvm::opt::ArgList
&Args
);
350 std::string
ComputeEffectiveClangTriple(const llvm::opt::ArgList
&Args
,
351 types::ID InputType
) const override
;
353 /// @name Apple Specific Toolchain Implementation
357 addMinVersionArgs(const llvm::opt::ArgList
&Args
,
358 llvm::opt::ArgStringList
&CmdArgs
) const override
;
361 addStartObjectFileArgs(const llvm::opt::ArgList
&Args
,
362 llvm::opt::ArgStringList
&CmdArgs
) const override
;
364 bool isKernelStatic() const override
{
365 return !isTargetIPhoneOS() || isIPhoneOSVersionLT(6, 0) ||
366 getTriple().getArch() == llvm::Triple::aarch64
;
371 /// @name Darwin specific Toolchain functions
374 // FIXME: Eliminate these ...Target functions and derive separate tool chains
375 // for these targets and put version in constructor.
376 void setTarget(DarwinPlatformKind Platform
, unsigned Major
, unsigned Minor
,
377 unsigned Micro
) const {
378 // FIXME: For now, allow reinitialization as long as values don't
379 // change. This will go away when we move away from argument translation.
380 if (TargetInitialized
&& TargetPlatform
== Platform
&&
381 TargetVersion
== VersionTuple(Major
, Minor
, Micro
))
384 assert(!TargetInitialized
&& "Target already initialized!");
385 TargetInitialized
= true;
386 TargetPlatform
= Platform
;
387 TargetVersion
= VersionTuple(Major
, Minor
, Micro
);
390 bool isTargetIPhoneOS() const {
391 assert(TargetInitialized
&& "Target not initialized!");
392 return TargetPlatform
== IPhoneOS
;
395 bool isTargetIOSSimulator() const {
396 assert(TargetInitialized
&& "Target not initialized!");
397 return TargetPlatform
== IPhoneOSSimulator
;
400 bool isTargetIOSBased() const {
401 assert(TargetInitialized
&& "Target not initialized!");
402 return isTargetIPhoneOS() || isTargetIOSSimulator();
405 bool isTargetMacOS() const {
406 return TargetPlatform
== MacOS
;
409 bool isTargetInitialized() const { return TargetInitialized
; }
411 VersionTuple
getTargetVersion() const {
412 assert(TargetInitialized
&& "Target not initialized!");
413 return TargetVersion
;
416 bool isIPhoneOSVersionLT(unsigned V0
, unsigned V1
=0, unsigned V2
=0) const {
417 assert(isTargetIOSBased() && "Unexpected call for non iOS target!");
418 return TargetVersion
< VersionTuple(V0
, V1
, V2
);
421 bool isMacosxVersionLT(unsigned V0
, unsigned V1
=0, unsigned V2
=0) const {
422 assert(isTargetMacOS() && "Unexpected call for non OS X target!");
423 return TargetVersion
< VersionTuple(V0
, V1
, V2
);
428 /// @name ToolChain Implementation
431 // Darwin tools support multiple architecture (e.g., i386 and x86_64) and
432 // most development is done against SDKs, so compiling for a different
433 // architecture should not get any special treatment.
434 bool isCrossCompiling() const override
{ return false; }
436 llvm::opt::DerivedArgList
*
437 TranslateArgs(const llvm::opt::DerivedArgList
&Args
,
438 const char *BoundArch
) const override
;
440 ObjCRuntime
getDefaultObjCRuntime(bool isNonFragile
) const override
;
441 bool hasBlocksRuntime() const override
;
443 bool UseObjCMixedDispatch() const override
{
444 // This is only used with the non-fragile ABI and non-legacy dispatch.
446 // Mixed dispatch is used everywhere except OS X before 10.6.
447 return !(isTargetMacOS() && isMacosxVersionLT(10, 6));
450 unsigned GetDefaultStackProtectorLevel(bool KernelOrKext
) const override
{
451 // Stack protectors default to on for user code on 10.5,
452 // and for everything in 10.6 and beyond
453 if (isTargetIOSBased())
455 else if (isTargetMacOS() && !isMacosxVersionLT(10, 6))
457 else if (isTargetMacOS() && !isMacosxVersionLT(10, 5) && !KernelOrKext
)
463 bool SupportsObjCGC() const override
;
465 void CheckObjCARC() const override
;
467 bool UseSjLjExceptions() const override
;
470 /// DarwinClang - The Darwin toolchain used by Clang.
471 class LLVM_LIBRARY_VISIBILITY DarwinClang
: public Darwin
{
473 DarwinClang(const Driver
&D
, const llvm::Triple
&Triple
,
474 const llvm::opt::ArgList
&Args
);
476 /// @name Apple ToolChain Implementation
480 AddLinkRuntimeLibArgs(const llvm::opt::ArgList
&Args
,
481 llvm::opt::ArgStringList
&CmdArgs
) const override
;
484 AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
485 llvm::opt::ArgStringList
&CmdArgs
) const override
;
488 AddCCKextLibArgs(const llvm::opt::ArgList
&Args
,
489 llvm::opt::ArgStringList
&CmdArgs
) const override
;
491 virtual void addClangWarningOptions(llvm::opt::ArgStringList
&CC1Args
)
495 AddLinkARCArgs(const llvm::opt::ArgList
&Args
,
496 llvm::opt::ArgStringList
&CmdArgs
) const override
;
500 class LLVM_LIBRARY_VISIBILITY Generic_ELF
: public Generic_GCC
{
501 virtual void anchor();
503 Generic_ELF(const Driver
&D
, const llvm::Triple
&Triple
,
504 const llvm::opt::ArgList
&Args
)
505 : Generic_GCC(D
, Triple
, Args
) {}
507 void addClangTargetOptions(const llvm::opt::ArgList
&DriverArgs
,
508 llvm::opt::ArgStringList
&CC1Args
) const override
;
511 class LLVM_LIBRARY_VISIBILITY Solaris
: public Generic_GCC
{
513 Solaris(const Driver
&D
, const llvm::Triple
&Triple
,
514 const llvm::opt::ArgList
&Args
);
516 bool IsIntegratedAssemblerDefault() const override
{ return true; }
518 Tool
*buildAssembler() const override
;
519 Tool
*buildLinker() const override
;
524 class LLVM_LIBRARY_VISIBILITY OpenBSD
: public Generic_ELF
{
526 OpenBSD(const Driver
&D
, const llvm::Triple
&Triple
,
527 const llvm::opt::ArgList
&Args
);
529 bool IsMathErrnoDefault() const override
{ return false; }
530 bool IsObjCNonFragileABIDefault() const override
{ return true; }
531 bool isPIEDefault() const override
{ return true; }
533 unsigned GetDefaultStackProtectorLevel(bool KernelOrKext
) const override
{
538 Tool
*buildAssembler() const override
;
539 Tool
*buildLinker() const override
;
542 class LLVM_LIBRARY_VISIBILITY Bitrig
: public Generic_ELF
{
544 Bitrig(const Driver
&D
, const llvm::Triple
&Triple
,
545 const llvm::opt::ArgList
&Args
);
547 bool IsMathErrnoDefault() const override
{ return false; }
548 bool IsObjCNonFragileABIDefault() const override
{ return true; }
550 CXXStdlibType
GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
552 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
553 llvm::opt::ArgStringList
&CC1Args
) const override
;
554 void AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
555 llvm::opt::ArgStringList
&CmdArgs
) const override
;
556 unsigned GetDefaultStackProtectorLevel(bool KernelOrKext
) const override
{
561 Tool
*buildAssembler() const override
;
562 Tool
*buildLinker() const override
;
565 class LLVM_LIBRARY_VISIBILITY FreeBSD
: public Generic_ELF
{
567 FreeBSD(const Driver
&D
, const llvm::Triple
&Triple
,
568 const llvm::opt::ArgList
&Args
);
569 bool HasNativeLLVMSupport() const override
;
571 bool IsMathErrnoDefault() const override
{ return false; }
572 bool IsObjCNonFragileABIDefault() const override
{ return true; }
574 CXXStdlibType
GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
576 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
577 llvm::opt::ArgStringList
&CC1Args
) const override
;
579 bool UseSjLjExceptions() const override
;
580 bool isPIEDefault() const override
;
582 Tool
*buildAssembler() const override
;
583 Tool
*buildLinker() const override
;
586 class LLVM_LIBRARY_VISIBILITY NetBSD
: public Generic_ELF
{
588 NetBSD(const Driver
&D
, const llvm::Triple
&Triple
,
589 const llvm::opt::ArgList
&Args
);
591 bool IsMathErrnoDefault() const override
{ return false; }
592 bool IsObjCNonFragileABIDefault() const override
{ return true; }
594 CXXStdlibType
GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
597 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
598 llvm::opt::ArgStringList
&CC1Args
) const override
;
599 bool IsUnwindTablesDefault() const override
{
604 Tool
*buildAssembler() const override
;
605 Tool
*buildLinker() const override
;
608 class LLVM_LIBRARY_VISIBILITY Minix
: public Generic_ELF
{
610 Minix(const Driver
&D
, const llvm::Triple
&Triple
,
611 const llvm::opt::ArgList
&Args
);
613 bool IsMathErrnoDefault() const override
{ return false; }
614 bool IsObjCNonFragileABIDefault() const override
{ return true; }
616 CXXStdlibType
GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
619 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
620 llvm::opt::ArgStringList
&CC1Args
) const override
;
621 bool IsUnwindTablesDefault() const override
{
626 Tool
*buildAssembler() const override
;
627 Tool
*buildLinker() const override
;
630 class LLVM_LIBRARY_VISIBILITY DragonFly
: public Generic_ELF
{
632 DragonFly(const Driver
&D
, const llvm::Triple
&Triple
,
633 const llvm::opt::ArgList
&Args
);
635 bool IsMathErrnoDefault() const override
{ return false; }
638 Tool
*buildAssembler() const override
;
639 Tool
*buildLinker() const override
;
642 class LLVM_LIBRARY_VISIBILITY Linux
: public Generic_ELF
{
644 Linux(const Driver
&D
, const llvm::Triple
&Triple
,
645 const llvm::opt::ArgList
&Args
);
647 bool HasNativeLLVMSupport() const override
;
650 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
651 llvm::opt::ArgStringList
&CC1Args
) const override
;
653 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
654 llvm::opt::ArgStringList
&CC1Args
) const override
;
655 bool isPIEDefault() const override
;
658 std::vector
<std::string
> ExtraOpts
;
661 Tool
*buildAssembler() const override
;
662 Tool
*buildLinker() const override
;
665 static bool addLibStdCXXIncludePaths(Twine Base
, Twine Suffix
,
667 StringRef GCCMultiarchTriple
,
668 StringRef TargetMultiarchTriple
,
670 const llvm::opt::ArgList
&DriverArgs
,
671 llvm::opt::ArgStringList
&CC1Args
);
673 std::string
computeSysRoot() const;
676 class LLVM_LIBRARY_VISIBILITY Hexagon_TC
: public Linux
{
678 GCCVersion GCCLibAndIncVersion
;
679 Tool
*buildAssembler() const override
;
680 Tool
*buildLinker() const override
;
683 Hexagon_TC(const Driver
&D
, const llvm::Triple
&Triple
,
684 const llvm::opt::ArgList
&Args
);
688 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
689 llvm::opt::ArgStringList
&CC1Args
) const override
;
691 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
692 llvm::opt::ArgStringList
&CC1Args
) const override
;
693 CXXStdlibType
GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
695 StringRef
GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion
.Text
; }
697 static std::string
GetGnuDir(const std::string
&InstalledDir
,
698 const llvm::opt::ArgList
&Args
);
700 static StringRef
GetTargetCPU(const llvm::opt::ArgList
&Args
);
703 /// TCEToolChain - A tool chain using the llvm bitcode tools to perform
704 /// all subcommands. See http://tce.cs.tut.fi for our peculiar target.
705 class LLVM_LIBRARY_VISIBILITY TCEToolChain
: public ToolChain
{
707 TCEToolChain(const Driver
&D
, const llvm::Triple
&Triple
,
708 const llvm::opt::ArgList
&Args
);
711 bool IsMathErrnoDefault() const override
;
712 bool isPICDefault() const override
;
713 bool isPIEDefault() const override
;
714 bool isPICDefaultForced() const override
;
717 class LLVM_LIBRARY_VISIBILITY MSVCToolChain
: public ToolChain
{
719 MSVCToolChain(const Driver
&D
, const llvm::Triple
&Triple
,
720 const llvm::opt::ArgList
&Args
);
722 bool IsIntegratedAssemblerDefault() const override
;
723 bool IsUnwindTablesDefault() const override
;
724 bool isPICDefault() const override
;
725 bool isPIEDefault() const override
;
726 bool isPICDefaultForced() const override
;
729 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
730 llvm::opt::ArgStringList
&CC1Args
) const override
;
732 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
733 llvm::opt::ArgStringList
&CC1Args
) const override
;
735 bool getWindowsSDKDir(std::string
&path
, int &major
, int &minor
) const;
736 bool getWindowsSDKLibraryPath(std::string
&path
) const;
737 bool getVisualStudioInstallDir(std::string
&path
) const;
738 bool getVisualStudioBinariesFolder(const char *clangProgramPath
,
739 std::string
&path
) const;
742 void AddSystemIncludeWithSubfolder(const llvm::opt::ArgList
&DriverArgs
,
743 llvm::opt::ArgStringList
&CC1Args
,
744 const std::string
&folder
,
745 const char *subfolder
) const;
747 Tool
*buildLinker() const override
;
748 Tool
*buildAssembler() const override
;
751 class LLVM_LIBRARY_VISIBILITY CrossWindowsToolChain
: public Generic_GCC
{
753 CrossWindowsToolChain(const Driver
&D
, const llvm::Triple
&T
,
754 const llvm::opt::ArgList
&Args
);
756 bool IsIntegratedAssemblerDefault() const override
{ return true; }
757 bool IsUnwindTablesDefault() const override
;
758 bool isPICDefault() const override
;
759 bool isPIEDefault() const override
;
760 bool isPICDefaultForced() const override
;
762 unsigned int GetDefaultStackProtectorLevel(bool KernelOrKext
) const override
{
766 void AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
767 llvm::opt::ArgStringList
&CC1Args
)
769 void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
770 llvm::opt::ArgStringList
&CC1Args
)
772 void AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
773 llvm::opt::ArgStringList
&CmdArgs
) const override
;
776 Tool
*buildLinker() const override
;
777 Tool
*buildAssembler() const override
;
780 class LLVM_LIBRARY_VISIBILITY XCore
: public ToolChain
{
782 XCore(const Driver
&D
, const llvm::Triple
&Triple
,
783 const llvm::opt::ArgList
&Args
);
785 Tool
*buildAssembler() const override
;
786 Tool
*buildLinker() const override
;
788 bool isPICDefault() const override
;
789 bool isPIEDefault() const override
;
790 bool isPICDefaultForced() const override
;
791 bool SupportsProfiling() const override
;
792 bool hasBlocksRuntime() const override
;
793 void AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
794 llvm::opt::ArgStringList
&CC1Args
) const override
;
795 void addClangTargetOptions(const llvm::opt::ArgList
&DriverArgs
,
796 llvm::opt::ArgStringList
&CC1Args
) const override
;
797 void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
798 llvm::opt::ArgStringList
&CC1Args
) const override
;
799 void AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
800 llvm::opt::ArgStringList
&CmdArgs
) const override
;
803 } // end namespace toolchains
804 } // end namespace driver
805 } // end namespace clang