]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Driver/ToolChains/OpenBSD.h
Merge clang trunk r300422 and resolve conflicts.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Driver / ToolChains / OpenBSD.h
1 //===--- OpenBSD.h - OpenBSD ToolChain Implementations ----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
11 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
12
13 #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 GnuTool {
24 public:
25   Assembler(const ToolChain &TC)
26       : GnuTool("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 GnuTool {
37 public:
38   Linker(const ToolChain &TC) : GnuTool("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 IsMathErrnoDefault() const override { return false; }
59   bool IsObjCNonFragileABIDefault() const override { return true; }
60   bool isPIEDefault() const override { return true; }
61
62   unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
63     return 2;
64   }
65   unsigned GetDefaultDwarfVersion() const override { return 2; }
66
67 protected:
68   Tool *buildAssembler() const override;
69   Tool *buildLinker() const override;
70 };
71
72 } // end namespace toolchains
73 } // end namespace driver
74 } // end namespace clang
75
76 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H