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/Basic/LangOptions.h"
14#include "clang/Driver/Tool.h"
15#include "clang/Driver/ToolChain.h"
16
17namespace clang {
18namespace driver {
19namespace tools {
20namespace fuchsia {
21class LLVM_LIBRARY_VISIBILITY StaticLibTool : public Tool {
22public:
23 StaticLibTool(const ToolChain &TC)
24 : Tool("fuchsia::StaticLibTool", "llvm-ar", TC) {}
25
26 bool hasIntegratedCPP() const override { return false; }
27 bool isLinkJob() const override { return true; }
28
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;
33};
34
35class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
36public:
37 Linker(const ToolChain &TC) : Tool("fuchsia::Linker", "ld.lld", TC) {}
38
39 bool hasIntegratedCPP() const override { return false; }
40 bool isLinkJob() const override { return true; }
41
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;
46};
47} // end namespace fuchsia
48} // end namespace tools
49
50namespace toolchains {
51
52class LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain {
53public:
54 Fuchsia(const Driver &D, const llvm::Triple &Triple,
55 const llvm::opt::ArgList &Args);
56
57 bool HasNativeLLVMSupport() const override { return true; }
58 bool IsMathErrnoDefault() const override { return false; }
59 RuntimeLibType GetDefaultRuntimeLibType() const override {
60 return ToolChain::RLT_CompilerRT;
61 }
62 CXXStdlibType GetDefaultCXXStdlibType() const override {
63 return ToolChain::CST_Libcxx;
64 }
65 UnwindTableLevel
66 getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override {
67 return UnwindTableLevel::Asynchronous;
68 }
69 bool isPICDefault() const override { return false; }
70 bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
71 return true;
72 }
73 bool isPICDefaultForced() const override { return false; }
74 llvm::DebuggerKind getDefaultDebuggerTuning() const override {
75 return llvm::DebuggerKind::GDB;
76 }
77
78 LangOptions::StackProtectorMode
79 GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
80 return LangOptions::SSPStrong;
81 }
82
83 std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
84 types::ID InputType) const override;
85
86 SanitizerMask getSupportedSanitizers() const override;
87 SanitizerMask getDefaultSanitizers() const override;
88
89 RuntimeLibType
90 GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
91 CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
92
93 bool IsAArch64OutlineAtomicsDefault(
94 const llvm::opt::ArgList &Args) const override {
95 return true;
96 }
97
98 void
99 addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
100 llvm::opt::ArgStringList &CC1Args,
101 Action::OffloadKind DeviceOffloadKind) const override;
102 void
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;
110
111 const char *getDefaultLinker() const override { return "ld.lld"; }
112
113protected:
114 Tool *buildLinker() const override;
115 Tool *buildStaticLibTool() const override;
116};
117
118} // end namespace toolchains
119} // end namespace driver
120} // end namespace clang
121
122#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H
123

source code of clang/lib/Driver/ToolChains/Fuchsia.h