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 Linker
: public Tool
{
23 Linker(const ToolChain
&TC
) : Tool("fuchsia::Linker", "ld.lld", TC
) {}
25 bool hasIntegratedCPP() const override
{ return false; }
26 bool isLinkJob() const override
{ return true; }
28 void ConstructJob(Compilation
&C
, const JobAction
&JA
,
29 const InputInfo
&Output
, const InputInfoList
&Inputs
,
30 const llvm::opt::ArgList
&TCArgs
,
31 const char *LinkingOutput
) const override
;
33 } // end namespace fuchsia
34 } // end namespace tools
36 namespace toolchains
{
38 class LLVM_LIBRARY_VISIBILITY Fuchsia
: public ToolChain
{
40 Fuchsia(const Driver
&D
, const llvm::Triple
&Triple
,
41 const llvm::opt::ArgList
&Args
);
43 bool HasNativeLLVMSupport() const override
{ return true; }
44 bool IsIntegratedAssemblerDefault() const override
{ return true; }
45 bool IsMathErrnoDefault() const override
{ return false; }
46 bool useRelaxRelocations() const override
{ return true; };
47 RuntimeLibType
GetDefaultRuntimeLibType() const override
{
48 return ToolChain::RLT_CompilerRT
;
50 CXXStdlibType
GetDefaultCXXStdlibType() const override
{
51 return ToolChain::CST_Libcxx
;
53 bool IsUnwindTablesDefault(const llvm::opt::ArgList
&Args
) const override
{
56 bool isPICDefault() const override
{ return false; }
57 bool isPIEDefault(const llvm::opt::ArgList
&Args
) const override
{
60 bool isPICDefaultForced() const override
{ return false; }
61 llvm::DebuggerKind
getDefaultDebuggerTuning() const override
{
62 return llvm::DebuggerKind::GDB
;
65 LangOptions::StackProtectorMode
66 GetDefaultStackProtectorLevel(bool KernelOrKext
) const override
{
67 return LangOptions::SSPStrong
;
70 std::string
ComputeEffectiveClangTriple(const llvm::opt::ArgList
&Args
,
71 types::ID InputType
) const override
;
73 SanitizerMask
getSupportedSanitizers() const override
;
74 SanitizerMask
getDefaultSanitizers() const override
;
77 GetRuntimeLibType(const llvm::opt::ArgList
&Args
) const override
;
78 CXXStdlibType
GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
80 bool IsAArch64OutlineAtomicsDefault(
81 const llvm::opt::ArgList
&Args
) const override
{
86 addClangTargetOptions(const llvm::opt::ArgList
&DriverArgs
,
87 llvm::opt::ArgStringList
&CC1Args
,
88 Action::OffloadKind DeviceOffloadKind
) const override
;
90 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
91 llvm::opt::ArgStringList
&CC1Args
) const override
;
92 void AddClangCXXStdlibIncludeArgs(
93 const llvm::opt::ArgList
&DriverArgs
,
94 llvm::opt::ArgStringList
&CC1Args
) const override
;
95 void AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
96 llvm::opt::ArgStringList
&CmdArgs
) const override
;
98 const char *getDefaultLinker() const override
{ return "ld.lld"; }
101 Tool
*buildLinker() const override
;
104 } // end namespace toolchains
105 } // end namespace driver
106 } // end namespace clang
108 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H