clang 10.0.0git

Fuchsia.h
Go to the documentation of this file.
1 //===--- Fuchsia.h - Fuchsia ToolChain Implementations ----------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
11
12 #include "Gnu.h"
13 #include "clang/Driver/Tool.h"
14 #include "clang/Driver/ToolChain.h"
15
16 namespace clang {
17 namespace driver {
18 namespace tools {
19 namespace fuchsia {
20 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
21 public:
22 Linker(const ToolChain &TC) : Tool("fuchsia::Linker", "ld.lld", TC) {}
23
24 bool hasIntegratedCPP() const override { return false; }
25 bool isLinkJob() const override { return true; }
26
27 void ConstructJob(Compilation &C, const JobAction &JA,
28 const InputInfo &Output, const InputInfoList &Inputs,
29 const llvm::opt::ArgList &TCArgs,
30 const char *LinkingOutput) const override;
31 };
32 } // end namespace fuchsia
33 } // end namespace tools
34
35 namespace toolchains {
36
37 class LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain {
38 public:
39 Fuchsia(const Driver &D, const llvm::Triple &Triple,
40 const llvm::opt::ArgList &Args);
41
42 bool HasNativeLLVMSupport() const override { return true; }
43 bool IsIntegratedAssemblerDefault() const override { return true; }
44 bool IsMathErrnoDefault() const override { return false; }
45 bool useRelaxRelocations() const override { return true; };
46 RuntimeLibType GetDefaultRuntimeLibType() const override {
47 return ToolChain::RLT_CompilerRT;
48 }
49 CXXStdlibType GetDefaultCXXStdlibType() const override {
50 return ToolChain::CST_Libcxx;
51 }
52 bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override {
53 return true;
54 }
55 bool isPICDefault() const override { return false; }
56 bool isPIEDefault() const override { return true; }
57 bool isPICDefaultForced() const override { return false; }
58 llvm::DebuggerKind getDefaultDebuggerTuning() const override {
59 return llvm::DebuggerKind::GDB;
60 }
61
62 unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
63 return 2; // SSPStrong
64 }
65
66 std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
67 types::ID InputType) const override;
68
69 SanitizerMask getSupportedSanitizers() const override;
70 SanitizerMask getDefaultSanitizers() const override;
71
72 RuntimeLibType
73 GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
74 CXXStdlibType
75 GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
76
77 void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
78 llvm::opt::ArgStringList &CC1Args,
79 Action::OffloadKind DeviceOffloadKind) const override;
80 void
81 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
82 llvm::opt::ArgStringList &CC1Args) const override;
83 void
84 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
85 llvm::opt::ArgStringList &CC1Args) const override;
86 void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
87 llvm::opt::ArgStringList &CmdArgs) const override;
88
89 const char *getDefaultLinker() const override {
90 return "ld.lld";
91 }
92
93 protected:
94 Tool *buildLinker() const override;
95 };
96
97 } // end namespace toolchains
98 } // end namespace driver
99 } // end namespace clang
100
101 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
Tool.h
clang::driver::types::ID
ID
Definition: Types.h:23
clang::driver::toolchains::Fuchsia::GetDefaultRuntimeLibType
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: Fuchsia.h:46
clang::driver::toolchains::Fuchsia
Definition: Fuchsia.h:37
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:92
clang::driver::toolchains::Fuchsia::IsIntegratedAssemblerDefault
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: Fuchsia.h:43
clang::driver::JobAction
Definition: Action.h:375
clang::driver::ToolChain::CST_Libcxx
Definition: ToolChain.h:93
clang::driver::toolchains::Fuchsia::GetDefaultStackProtectorLevel
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: Fuchsia.h:62
clang::driver::toolchains::Fuchsia::getDefaultLinker
const char * getDefaultLinker() const override
GetDefaultLinker - Get the default linker to use.
Definition: Fuchsia.h:89
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:97
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
clang::driver::toolchains::Fuchsia::isPICDefaultForced
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: Fuchsia.h:57
clang::driver::toolchains::Fuchsia::getDefaultDebuggerTuning
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: Fuchsia.h:58
clang::driver::tools::fuchsia::Linker::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: Fuchsia.h:24
clang::driver::tools::fuchsia::Linker
Definition: Fuchsia.h:20
clang::driver::tools::fuchsia::Linker::isLinkJob
bool isLinkJob() const override
Definition: Fuchsia.h:25
clang::driver::toolchains::Fuchsia::useRelaxRelocations
bool useRelaxRelocations() const override
Check whether to enable x86 relax relocations by default.
Definition: Fuchsia.h:45
ToolChain.h
clang::SanitizerMask
Definition: Sanitizers.h:29
llvm::SmallVector
Definition: LLVM.h:35
Gnu.h
clang::driver::ToolChain::RLT_CompilerRT
Definition: ToolChain.h:98
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:84
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
clang::driver::tools::fuchsia::Linker::Linker
Linker(const ToolChain &TC)
Definition: Fuchsia.h:22
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang::driver::toolchains::Fuchsia::IsUnwindTablesDefault
bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: Fuchsia.h:52
clang::driver::toolchains::Fuchsia::IsMathErrnoDefault
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: Fuchsia.h:44
clang::driver::toolchains::Fuchsia::isPIEDefault
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: Fuchsia.h:56
clang::driver::toolchains::Fuchsia::GetDefaultCXXStdlibType
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: Fuchsia.h:49
clang::driver::toolchains::Fuchsia::isPICDefault
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: Fuchsia.h:55
clang::driver::toolchains::Fuchsia::HasNativeLLVMSupport
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: Fuchsia.h:42
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88