OpenBSD.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H
  10. #include "Gnu.h"
  11. #include "clang/Basic/LangOptions.h"
  12. #include "clang/Driver/Tool.h"
  13. #include "clang/Driver/ToolChain.h"
  14. namespace clang {
  15. namespace driver {
  16. namespace tools {
  17. /// openbsd -- Directly call GNU Binutils assembler and linker
  18. namespace openbsd {
  19. class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
  20. public:
  21. Assembler(const ToolChain &TC)
  22. : Tool("openbsd::Assembler", "assembler", TC) {}
  23. bool hasIntegratedCPP() const override { return false; }
  24. void ConstructJob(Compilation &C, const JobAction &JA,
  25. const InputInfo &Output, const InputInfoList &Inputs,
  26. const llvm::opt::ArgList &TCArgs,
  27. const char *LinkingOutput) const override;
  28. };
  29. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  30. public:
  31. Linker(const ToolChain &TC) : Tool("openbsd::Linker", "linker", TC) {}
  32. bool hasIntegratedCPP() const override { return false; }
  33. bool isLinkJob() const override { return true; }
  34. void ConstructJob(Compilation &C, const JobAction &JA,
  35. const InputInfo &Output, const InputInfoList &Inputs,
  36. const llvm::opt::ArgList &TCArgs,
  37. const char *LinkingOutput) const override;
  38. };
  39. } // end namespace openbsd
  40. } // end namespace tools
  41. namespace toolchains {
  42. class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
  43. public:
  44. OpenBSD(const Driver &D, const llvm::Triple &Triple,
  45. const llvm::opt::ArgList &Args);
  46. bool HasNativeLLVMSupport() const override;
  47. bool IsMathErrnoDefault() const override { return false; }
  48. bool IsObjCNonFragileABIDefault() const override { return true; }
  49. bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
  50. return true;
  51. }
  52. RuntimeLibType GetDefaultRuntimeLibType() const override {
  53. return ToolChain::RLT_CompilerRT;
  54. }
  55. CXXStdlibType GetDefaultCXXStdlibType() const override {
  56. return ToolChain::CST_Libcxx;
  57. }
  58. void
  59. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  60. llvm::opt::ArgStringList &CC1Args) const override;
  61. void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
  62. llvm::opt::ArgStringList &CC1Args) const override;
  63. void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
  64. llvm::opt::ArgStringList &CmdArgs) const override;
  65. std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
  66. FileType Type = ToolChain::FT_Static) const override;
  67. bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
  68. LangOptions::StackProtectorMode
  69. GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
  70. return LangOptions::SSPStrong;
  71. }
  72. unsigned GetDefaultDwarfVersion() const override { return 2; }
  73. SanitizerMask getSupportedSanitizers() const override;
  74. protected:
  75. Tool *buildAssembler() const override;
  76. Tool *buildLinker() const override;
  77. };
  78. } // end namespace toolchains
  79. } // end namespace driver
  80. } // end namespace clang
  81. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H