xref: /netbsd-src/external/apache2/llvm/dist/clang/lib/Driver/ToolChains/AVR.h (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
17330f729Sjoerg //===--- AVR.h - AVR Tool and ToolChain Implementations ---------*- C++ -*-===//
27330f729Sjoerg //
37330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
47330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information.
57330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
67330f729Sjoerg //
77330f729Sjoerg //===----------------------------------------------------------------------===//
87330f729Sjoerg 
97330f729Sjoerg #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
107330f729Sjoerg #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
117330f729Sjoerg 
127330f729Sjoerg #include "Gnu.h"
137330f729Sjoerg #include "InputInfo.h"
147330f729Sjoerg #include "clang/Driver/ToolChain.h"
157330f729Sjoerg #include "clang/Driver/Tool.h"
167330f729Sjoerg 
177330f729Sjoerg namespace clang {
187330f729Sjoerg namespace driver {
197330f729Sjoerg namespace toolchains {
207330f729Sjoerg 
217330f729Sjoerg class LLVM_LIBRARY_VISIBILITY AVRToolChain : public Generic_ELF {
227330f729Sjoerg public:
237330f729Sjoerg   AVRToolChain(const Driver &D, const llvm::Triple &Triple,
247330f729Sjoerg                const llvm::opt::ArgList &Args);
257330f729Sjoerg 
267330f729Sjoerg protected:
277330f729Sjoerg   Tool *buildLinker() const override;
287330f729Sjoerg 
297330f729Sjoerg private:
307330f729Sjoerg   /// Whether libgcc, libct, and friends should be linked.
317330f729Sjoerg   ///
327330f729Sjoerg   /// This is not done if the user does not specify a
337330f729Sjoerg   /// microcontroller on the command line.
347330f729Sjoerg   bool LinkStdlib;
357330f729Sjoerg 
367330f729Sjoerg   llvm::Optional<std::string> findAVRLibcInstallation() const;
377330f729Sjoerg };
387330f729Sjoerg 
397330f729Sjoerg } // end namespace toolchains
407330f729Sjoerg 
417330f729Sjoerg namespace tools {
427330f729Sjoerg namespace AVR {
43*e038c9c4Sjoerg class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
447330f729Sjoerg public:
Linker(const llvm::Triple & Triple,const ToolChain & TC,bool LinkStdlib)457330f729Sjoerg   Linker(const llvm::Triple &Triple, const ToolChain &TC, bool LinkStdlib)
46*e038c9c4Sjoerg       : Tool("AVR::Linker", "avr-ld", TC), Triple(Triple),
477330f729Sjoerg         LinkStdlib(LinkStdlib) {}
487330f729Sjoerg 
hasIntegratedCPP()497330f729Sjoerg   bool hasIntegratedCPP() const override { return false; }
isLinkJob()507330f729Sjoerg   bool isLinkJob() const override { return true; }
517330f729Sjoerg   void ConstructJob(Compilation &C, const JobAction &JA,
527330f729Sjoerg                     const InputInfo &Output, const InputInfoList &Inputs,
537330f729Sjoerg                     const llvm::opt::ArgList &TCArgs,
547330f729Sjoerg                     const char *LinkingOutput) const override;
557330f729Sjoerg 
567330f729Sjoerg protected:
577330f729Sjoerg   const llvm::Triple &Triple;
587330f729Sjoerg   bool LinkStdlib;
597330f729Sjoerg };
607330f729Sjoerg } // end namespace AVR
617330f729Sjoerg } // end namespace tools
627330f729Sjoerg } // end namespace driver
637330f729Sjoerg } // end namespace clang
647330f729Sjoerg 
657330f729Sjoerg #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AVR_H
66