Fuchsia.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //===--- Fuchsia.h - Fuchsia 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_FUCHSIA_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_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. namespace fuchsia {
  18. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  19. public:
  20. Linker(const ToolChain &TC) : Tool("fuchsia::Linker", "ld.lld", TC) {}
  21. bool hasIntegratedCPP() const override { return false; }
  22. bool isLinkJob() const override { return true; }
  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. } // end namespace fuchsia
  29. } // end namespace tools
  30. namespace toolchains {
  31. class LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain {
  32. public:
  33. Fuchsia(const Driver &D, const llvm::Triple &Triple,
  34. const llvm::opt::ArgList &Args);
  35. bool HasNativeLLVMSupport() const override { return true; }
  36. bool IsIntegratedAssemblerDefault() const override { return true; }
  37. bool IsMathErrnoDefault() const override { return false; }
  38. bool useRelaxRelocations() const override { return true; };
  39. RuntimeLibType GetDefaultRuntimeLibType() const override {
  40. return ToolChain::RLT_CompilerRT;
  41. }
  42. CXXStdlibType GetDefaultCXXStdlibType() const override {
  43. return ToolChain::CST_Libcxx;
  44. }
  45. bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override {
  46. return true;
  47. }
  48. bool isPICDefault() const override { return false; }
  49. bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
  50. return true;
  51. }
  52. bool isPICDefaultForced() const override { return false; }
  53. llvm::DebuggerKind getDefaultDebuggerTuning() const override {
  54. return llvm::DebuggerKind::GDB;
  55. }
  56. LangOptions::StackProtectorMode
  57. GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
  58. return LangOptions::SSPStrong;
  59. }
  60. std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
  61. types::ID InputType) const override;
  62. SanitizerMask getSupportedSanitizers() const override;
  63. SanitizerMask getDefaultSanitizers() const override;
  64. RuntimeLibType
  65. GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
  66. CXXStdlibType
  67. GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
  68. void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  69. llvm::opt::ArgStringList &CC1Args,
  70. Action::OffloadKind DeviceOffloadKind) const override;
  71. void
  72. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  73. llvm::opt::ArgStringList &CC1Args) const override;
  74. void
  75. AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  76. llvm::opt::ArgStringList &CC1Args) const override;
  77. void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
  78. llvm::opt::ArgStringList &CmdArgs) const override;
  79. const char *getDefaultLinker() const override {
  80. return "ld.lld";
  81. }
  82. protected:
  83. Tool *buildLinker() const override;
  84. };
  85. } // end namespace toolchains
  86. } // end namespace driver
  87. } // end namespace clang
  88. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H