NaCl.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //===--- NaCl.h - Native Client 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_NACL_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H
  10. #include "Gnu.h"
  11. #include "clang/Driver/Tool.h"
  12. #include "clang/Driver/ToolChain.h"
  13. namespace clang {
  14. namespace driver {
  15. namespace tools {
  16. namespace nacltools {
  17. class LLVM_LIBRARY_VISIBILITY AssemblerARM : public gnutools::Assembler {
  18. public:
  19. AssemblerARM(const ToolChain &TC) : gnutools::Assembler(TC) {}
  20. void ConstructJob(Compilation &C, const JobAction &JA,
  21. const InputInfo &Output, const InputInfoList &Inputs,
  22. const llvm::opt::ArgList &TCArgs,
  23. const char *LinkingOutput) const override;
  24. };
  25. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  26. public:
  27. Linker(const ToolChain &TC) : Tool("NaCl::Linker", "linker", TC) {}
  28. bool hasIntegratedCPP() const override { return false; }
  29. bool isLinkJob() const override { return true; }
  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. } // end namespace nacltools
  36. } // end namespace tools
  37. namespace toolchains {
  38. class LLVM_LIBRARY_VISIBILITY NaClToolChain : public Generic_ELF {
  39. public:
  40. NaClToolChain(const Driver &D, const llvm::Triple &Triple,
  41. const llvm::opt::ArgList &Args);
  42. void
  43. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  44. llvm::opt::ArgStringList &CC1Args) const override;
  45. void addLibCxxIncludePaths(
  46. const llvm::opt::ArgList &DriverArgs,
  47. llvm::opt::ArgStringList &CC1Args) const override;
  48. CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
  49. void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
  50. llvm::opt::ArgStringList &CmdArgs) const override;
  51. bool IsIntegratedAssemblerDefault() const override {
  52. return getTriple().getArch() == llvm::Triple::mipsel;
  53. }
  54. // Get the path to the file containing NaCl's ARM macros.
  55. // It lives in NaClToolChain because the ARMAssembler tool needs a
  56. // const char * that it can pass around,
  57. const char *GetNaClArmMacrosPath() const { return NaClArmMacrosPath.c_str(); }
  58. std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
  59. types::ID InputType) const override;
  60. protected:
  61. Tool *buildLinker() const override;
  62. Tool *buildAssembler() const override;
  63. private:
  64. std::string NaClArmMacrosPath;
  65. };
  66. } // end namespace toolchains
  67. } // end namespace driver
  68. } // end namespace clang
  69. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H