FreeBSD.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //===--- FreeBSD.h - FreeBSD 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_FREEBSD_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FREEBSD_H
  10. #include "Gnu.h"
  11. #include "clang/Driver/Driver.h"
  12. #include "clang/Driver/ToolChain.h"
  13. namespace clang {
  14. namespace driver {
  15. namespace tools {
  16. /// freebsd -- Directly call GNU Binutils assembler and linker
  17. namespace freebsd {
  18. class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
  19. public:
  20. Assembler(const ToolChain &TC)
  21. : Tool("freebsd::Assembler", "assembler", TC) {}
  22. bool hasIntegratedCPP() const override { return false; }
  23. void ConstructJob(Compilation &C, const JobAction &JA,
  24. const InputInfo &Output, const InputInfoList &Inputs,
  25. const llvm::opt::ArgList &TCArgs,
  26. const char *LinkingOutput) const override;
  27. };
  28. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  29. public:
  30. Linker(const ToolChain &TC) : Tool("freebsd::Linker", "linker", TC) {}
  31. bool hasIntegratedCPP() const override { return false; }
  32. bool isLinkJob() const override { return true; }
  33. void ConstructJob(Compilation &C, const JobAction &JA,
  34. const InputInfo &Output, const InputInfoList &Inputs,
  35. const llvm::opt::ArgList &TCArgs,
  36. const char *LinkingOutput) const override;
  37. };
  38. } // end namespace freebsd
  39. } // end namespace tools
  40. namespace toolchains {
  41. class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
  42. public:
  43. FreeBSD(const Driver &D, const llvm::Triple &Triple,
  44. const llvm::opt::ArgList &Args);
  45. bool HasNativeLLVMSupport() const override;
  46. bool IsMathErrnoDefault() const override { return false; }
  47. bool IsObjCNonFragileABIDefault() const override { return true; }
  48. CXXStdlibType GetDefaultCXXStdlibType() const override;
  49. void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
  50. llvm::opt::ArgStringList &CC1Args) const override;
  51. void
  52. addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
  53. llvm::opt::ArgStringList &CC1Args) const override;
  54. void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
  55. llvm::opt::ArgStringList &CmdArgs) const override;
  56. void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  57. llvm::opt::ArgStringList &CC1Args) const override;
  58. void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  59. llvm::opt::ArgStringList &CC1Args) const override;
  60. llvm::ExceptionHandling
  61. GetExceptionModel(const llvm::opt::ArgList &Args) const override;
  62. bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
  63. bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
  64. SanitizerMask getSupportedSanitizers() const override;
  65. unsigned GetDefaultDwarfVersion() const override;
  66. // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
  67. // FreeBSD defaults to standalone/full debug info.
  68. bool GetDefaultStandaloneDebug() const override { return true; }
  69. void
  70. addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  71. llvm::opt::ArgStringList &CC1Args,
  72. Action::OffloadKind DeviceOffloadKind) const override;
  73. protected:
  74. Tool *buildAssembler() const override;
  75. Tool *buildLinker() const override;
  76. };
  77. } // end namespace toolchains
  78. } // end namespace driver
  79. } // end namespace clang
  80. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FREEBSD_H