clang  10.0.0svn
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; };
48  }
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 
73  GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
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
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: Fuchsia.h:46
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: Fuchsia.h:43
unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain (0=off...
Definition: Fuchsia.h:62
const char * getDefaultLinker() const override
GetDefaultLinker - Get the default linker to use.
Definition: Fuchsia.h:89
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: Fuchsia.h:57
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: Fuchsia.h:58
bool hasIntegratedCPP() const override
Definition: Fuchsia.h:24
bool isLinkJob() const override
Definition: Fuchsia.h:25
bool useRelaxRelocations() const override
Check whether to enable x86 relax relocations by default.
Definition: Fuchsia.h:45
Dataflow Directional Tag Classes.
Tool - Information on a specific compilation tool.
Definition: Tool.h:33
Linker(const ToolChain &TC)
Definition: Fuchsia.h:22
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: Fuchsia.h:52
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: Fuchsia.h:44
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: Fuchsia.h:56
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: Fuchsia.h:49
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: Fuchsia.h:55
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: Fuchsia.h:42
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88