clang  14.0.0git
OpenBSD.h
Go to the documentation of this file.
1 //===--- OpenBSD.h - OpenBSD 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_OPENBSD_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
11 
12 #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 
21 /// openbsd -- Directly call GNU Binutils assembler and linker
22 namespace openbsd {
23 class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
24 public:
25  Assembler(const ToolChain &TC)
26  : Tool("openbsd::Assembler", "assembler", TC) {}
27 
28  bool hasIntegratedCPP() const override { return false; }
29 
30  void ConstructJob(Compilation &C, const JobAction &JA,
31  const InputInfo &Output, const InputInfoList &Inputs,
32  const llvm::opt::ArgList &TCArgs,
33  const char *LinkingOutput) const override;
34 };
35 
36 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
37 public:
38  Linker(const ToolChain &TC) : Tool("openbsd::Linker", "linker", TC) {}
39 
40  bool hasIntegratedCPP() const override { return false; }
41  bool isLinkJob() const override { return true; }
42 
43  void ConstructJob(Compilation &C, const JobAction &JA,
44  const InputInfo &Output, const InputInfoList &Inputs,
45  const llvm::opt::ArgList &TCArgs,
46  const char *LinkingOutput) const override;
47 };
48 } // end namespace openbsd
49 } // end namespace tools
50 
51 namespace toolchains {
52 
53 class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
54 public:
55  OpenBSD(const Driver &D, const llvm::Triple &Triple,
56  const llvm::opt::ArgList &Args);
57 
58  bool HasNativeLLVMSupport() const override;
59 
60  bool IsMathErrnoDefault() const override { return false; }
61  bool IsObjCNonFragileABIDefault() const override { return true; }
62  bool isPIEDefault() const override { return true; }
63 
66  }
68  return ToolChain::CST_Libcxx;
69  }
70 
71  void
72  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
73  llvm::opt::ArgStringList &CC1Args) const override;
74 
75  void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
76  llvm::opt::ArgStringList &CC1Args) const override;
77  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
78  llvm::opt::ArgStringList &CmdArgs) const override;
79 
80  std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
81  FileType Type = ToolChain::FT_Static) const override;
82 
84  GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
86  }
87  unsigned GetDefaultDwarfVersion() const override { return 2; }
88 
89  SanitizerMask getSupportedSanitizers() const override;
90 
91 protected:
92  Tool *buildAssembler() const override;
93  Tool *buildLinker() const override;
94 };
95 
96 } // end namespace toolchains
97 } // end namespace driver
98 } // end namespace clang
99 
100 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
clang::LangOptions::StackProtectorMode
StackProtectorMode
Definition: LangOptions.h:64
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::tools::openbsd::Linker::Linker
Linker(const ToolChain &TC)
Definition: OpenBSD.h:38
clang::LangOptions::SSPStrong
@ SSPStrong
Definition: LangOptions.h:64
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::toolchains::OpenBSD::isPIEDefault
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: OpenBSD.h:62
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::toolchains::OpenBSD::GetDefaultRuntimeLibType
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: OpenBSD.h:64
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:100
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1490
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::toolchains::Generic_ELF
Definition: Gnu.h:362
clang::driver::toolchains::OpenBSD::GetDefaultDwarfVersion
unsigned GetDefaultDwarfVersion() const override
Definition: OpenBSD.h:87
LangOptions.h
clang::driver::tools::openbsd::Linker
Definition: OpenBSD.h:36
clang::driver::toolchains::OpenBSD::GetDefaultStackProtectorLevel
LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: OpenBSD.h:84
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
Tool.h
clang::driver::ToolChain::CST_Libcxx
@ CST_Libcxx
Definition: ToolChain.h:96
clang::driver::toolchains::OpenBSD::IsObjCNonFragileABIDefault
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: OpenBSD.h:61
clang::driver::tools::openbsd::Assembler
Definition: OpenBSD.h:23
ToolChain.h
clang::driver::ToolChain::FT_Static
@ FT_Static
Definition: ToolChain.h:123
clang::driver::tools::openbsd::Linker::isLinkJob
bool isLinkJob() const override
Definition: OpenBSD.h:41
clang::driver::tools::openbsd::Assembler::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: OpenBSD.h:28
Gnu.h
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::ToolChain::RLT_CompilerRT
@ RLT_CompilerRT
Definition: ToolChain.h:101
clang::driver::tools::openbsd::Linker::hasIntegratedCPP
bool hasIntegratedCPP() const override
Definition: OpenBSD.h:40
clang::driver::tools::openbsd::Assembler::Assembler
Assembler(const ToolChain &TC)
Definition: OpenBSD.h:25
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang
Definition: CalledOnceCheck.h:17
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::OpenBSD::GetDefaultCXXStdlibType
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: OpenBSD.h:67
clang::driver::toolchains::OpenBSD
Definition: OpenBSD.h:53
clang::driver::JobAction
Definition: Action.h:380
clang::driver::toolchains::OpenBSD::IsMathErrnoDefault
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: OpenBSD.h:60
clang::SanitizerMask
Definition: Sanitizers.h:30