clang 19.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"
16
17namespace clang {
18namespace driver {
19namespace tools {
20
21/// Directly call GNU Binutils assembler and linker
22namespace openbsd {
23class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool {
24public:
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
36class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
37public:
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
51namespace toolchains {
52
53class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
54public:
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 llvm::opt::ArgList &Args) const override {
63 return true;
64 }
65
67 return ToolChain::RLT_CompilerRT;
68 }
70 return ToolChain::CST_Libcxx;
71 }
72
73 void
74 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
75 llvm::opt::ArgStringList &CC1Args) const override;
76
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;
81
82 std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
83 FileType Type = ToolChain::FT_Static) const override;
84
85 UnwindTableLevel
86 getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override;
87
89 GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
90 return LangOptions::SSPStrong;
91 }
92 unsigned GetDefaultDwarfVersion() const override { return 2; }
93
94 SanitizerMask getSupportedSanitizers() const override;
95
96protected:
97 Tool *buildAssembler() const override;
98 Tool *buildLinker() const override;
99};
100
101} // end namespace toolchains
102} // end namespace driver
103} // end namespace clang
104
105#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
Defines the clang::LangOptions interface.
llvm::MachO::FileType FileType
Definition: MachO.h:45
The base class of the type hierarchy.
Definition: Type.h:1607
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:77
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: OpenBSD.h:69
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: OpenBSD.h:60
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: OpenBSD.h:61
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: OpenBSD.h:66
LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: OpenBSD.h:89
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: OpenBSD.h:62
unsigned GetDefaultDwarfVersion() const override
Definition: OpenBSD.h:92
Assembler(const ToolChain &TC)
Definition: OpenBSD.h:25
bool hasIntegratedCPP() const override
Definition: OpenBSD.h:28
Linker(const ToolChain &TC)
Definition: OpenBSD.h:38
bool isLinkJob() const override
Definition: OpenBSD.h:41
bool hasIntegratedCPP() const override
Definition: OpenBSD.h:40
The JSON file list parser is used to communicate input to InstallAPI.