AVR.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //===--- AVR.h - AVR Tool and 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_AVR_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
  10. #include "Gnu.h"
  11. #include "clang/Driver/InputInfo.h"
  12. #include "clang/Driver/Tool.h"
  13. #include "clang/Driver/ToolChain.h"
  14. namespace clang {
  15. namespace driver {
  16. namespace toolchains {
  17. class LLVM_LIBRARY_VISIBILITY AVRToolChain : public Generic_ELF {
  18. public:
  19. AVRToolChain(const Driver &D, const llvm::Triple &Triple,
  20. const llvm::opt::ArgList &Args);
  21. void
  22. AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  23. llvm::opt::ArgStringList &CC1Args) const override;
  24. void
  25. addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  26. llvm::opt::ArgStringList &CC1Args,
  27. Action::OffloadKind DeviceOffloadKind) const override;
  28. protected:
  29. Tool *buildLinker() const override;
  30. private:
  31. /// Whether libgcc, libct, and friends should be linked.
  32. ///
  33. /// This is not done if the user does not specify a
  34. /// microcontroller on the command line.
  35. bool LinkStdlib;
  36. llvm::Optional<std::string> findAVRLibcInstallation() const;
  37. };
  38. } // end namespace toolchains
  39. namespace tools {
  40. namespace AVR {
  41. class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
  42. public:
  43. Linker(const llvm::Triple &Triple, const ToolChain &TC, bool LinkStdlib)
  44. : Tool("AVR::Linker", "avr-ld", TC), Triple(Triple),
  45. LinkStdlib(LinkStdlib) {}
  46. bool hasIntegratedCPP() const override { return false; }
  47. bool isLinkJob() const override { return true; }
  48. void ConstructJob(Compilation &C, const JobAction &JA,
  49. const InputInfo &Output, const InputInfoList &Inputs,
  50. const llvm::opt::ArgList &TCArgs,
  51. const char *LinkingOutput) const override;
  52. protected:
  53. const llvm::Triple &Triple;
  54. bool LinkStdlib;
  55. };
  56. } // end namespace AVR
  57. } // end namespace tools
  58. } // end namespace driver
  59. } // end namespace clang
  60. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H