1 //===--- OpenBSD.h - OpenBSD ToolChain Implementations ----------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
13 #include "clang/Basic/LangOptions.h"
14 #include "clang/Driver/Tool.h"
15 #include "clang/Driver/ToolChain.h"
21 /// openbsd -- Directly call GNU Binutils assembler and linker
23 class LLVM_LIBRARY_VISIBILITY Assembler
: public Tool
{
25 Assembler(const ToolChain
&TC
)
26 : Tool("openbsd::Assembler", "assembler", TC
) {}
28 bool hasIntegratedCPP() const override
{ return false; }
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
;
36 class LLVM_LIBRARY_VISIBILITY Linker
: public Tool
{
38 Linker(const ToolChain
&TC
) : Tool("openbsd::Linker", "linker", TC
) {}
40 bool hasIntegratedCPP() const override
{ return false; }
41 bool isLinkJob() const override
{ return true; }
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
;
48 } // end namespace openbsd
49 } // end namespace tools
51 namespace toolchains
{
53 class LLVM_LIBRARY_VISIBILITY OpenBSD
: public Generic_ELF
{
55 OpenBSD(const Driver
&D
, const llvm::Triple
&Triple
,
56 const llvm::opt::ArgList
&Args
);
58 bool HasNativeLLVMSupport() const override
;
60 bool IsMathErrnoDefault() const override
{ return false; }
61 bool IsObjCNonFragileABIDefault() const override
{ return true; }
62 bool isPIEDefault(const llvm::opt::ArgList
&Args
) const override
{
66 RuntimeLibType
GetDefaultRuntimeLibType() const override
{
67 return ToolChain::RLT_CompilerRT
;
69 CXXStdlibType
GetDefaultCXXStdlibType() const override
{
70 return ToolChain::CST_Libcxx
;
74 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
75 llvm::opt::ArgStringList
&CC1Args
) const override
;
77 void addLibCxxIncludePaths(const llvm::opt::ArgList
&DriverArgs
,
78 llvm::opt::ArgStringList
&CC1Args
) const override
;
79 void AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
80 llvm::opt::ArgStringList
&CmdArgs
) const override
;
82 std::string
getCompilerRT(const llvm::opt::ArgList
&Args
, StringRef Component
,
83 FileType Type
= ToolChain::FT_Static
) const override
;
85 bool IsUnwindTablesDefault(const llvm::opt::ArgList
&Args
) const override
;
87 LangOptions::StackProtectorMode
88 GetDefaultStackProtectorLevel(bool KernelOrKext
) const override
{
89 return LangOptions::SSPStrong
;
91 unsigned GetDefaultDwarfVersion() const override
{ return 2; }
93 SanitizerMask
getSupportedSanitizers() const override
;
96 Tool
*buildAssembler() const override
;
97 Tool
*buildLinker() const override
;
100 } // end namespace toolchains
101 } // end namespace driver
102 } // end namespace clang
104 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H