1 //===--- Fuchsia.h - Fuchsia ToolChain Implementations ----------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
13 #include "clang/Basic/LangOptions.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
21 class LLVM_LIBRARY_VISIBILITY StaticLibTool
: public Tool
{
23 StaticLibTool(const ToolChain
&TC
)
24 : Tool("fuchsia::StaticLibTool", "llvm-ar", TC
) {}
26 bool hasIntegratedCPP() const override
{ return false; }
27 bool isLinkJob() const override
{ return true; }
29 void ConstructJob(Compilation
&C
, const JobAction
&JA
,
30 const InputInfo
&Output
, const InputInfoList
&Inputs
,
31 const llvm::opt::ArgList
&TCArgs
,
32 const char *LinkingOutput
) const override
;
35 class LLVM_LIBRARY_VISIBILITY Linker final
: public Tool
{
37 Linker(const ToolChain
&TC
) : Tool("fuchsia::Linker", "ld.lld", TC
) {}
39 bool hasIntegratedCPP() const override
{ return false; }
40 bool isLinkJob() const override
{ return true; }
42 void ConstructJob(Compilation
&C
, const JobAction
&JA
,
43 const InputInfo
&Output
, const InputInfoList
&Inputs
,
44 const llvm::opt::ArgList
&TCArgs
,
45 const char *LinkingOutput
) const override
;
47 } // end namespace fuchsia
48 } // end namespace tools
50 namespace toolchains
{
52 class LLVM_LIBRARY_VISIBILITY Fuchsia
: public ToolChain
{
54 Fuchsia(const Driver
&D
, const llvm::Triple
&Triple
,
55 const llvm::opt::ArgList
&Args
);
57 bool HasNativeLLVMSupport() const override
{ return true; }
58 bool IsMathErrnoDefault() const override
{ return false; }
59 RuntimeLibType
GetDefaultRuntimeLibType() const override
{
60 return ToolChain::RLT_CompilerRT
;
62 CXXStdlibType
GetDefaultCXXStdlibType() const override
{
63 return ToolChain::CST_Libcxx
;
66 getDefaultUnwindTableLevel(const llvm::opt::ArgList
&Args
) const override
{
67 return UnwindTableLevel::Asynchronous
;
69 bool isPICDefault() const override
{ return false; }
70 bool isPIEDefault(const llvm::opt::ArgList
&Args
) const override
{
73 bool isPICDefaultForced() const override
{ return false; }
74 llvm::DebuggerKind
getDefaultDebuggerTuning() const override
{
75 return llvm::DebuggerKind::GDB
;
78 LangOptions::StackProtectorMode
79 GetDefaultStackProtectorLevel(bool KernelOrKext
) const override
{
80 return LangOptions::SSPStrong
;
83 std::string
ComputeEffectiveClangTriple(const llvm::opt::ArgList
&Args
,
84 types::ID InputType
) const override
;
86 SanitizerMask
getSupportedSanitizers() const override
;
87 SanitizerMask
getDefaultSanitizers() const override
;
90 GetRuntimeLibType(const llvm::opt::ArgList
&Args
) const override
;
91 CXXStdlibType
GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
93 bool IsAArch64OutlineAtomicsDefault(
94 const llvm::opt::ArgList
&Args
) const override
{
99 addClangTargetOptions(const llvm::opt::ArgList
&DriverArgs
,
100 llvm::opt::ArgStringList
&CC1Args
,
101 Action::OffloadKind DeviceOffloadKind
) const override
;
103 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
104 llvm::opt::ArgStringList
&CC1Args
) const override
;
105 void AddClangCXXStdlibIncludeArgs(
106 const llvm::opt::ArgList
&DriverArgs
,
107 llvm::opt::ArgStringList
&CC1Args
) const override
;
108 void AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
109 llvm::opt::ArgStringList
&CmdArgs
) const override
;
111 const char *getDefaultLinker() const override
{ return "ld.lld"; }
114 Tool
*buildLinker() const override
;
115 Tool
*buildStaticLibTool() const override
;
118 } // end namespace toolchains
119 } // end namespace driver
120 } // end namespace clang
122 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H