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