1 //===--- AVR.cpp - AVR 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 9 #include "AVR.h" 10 #include "CommonArgs.h" 11 #include "InputInfo.h" 12 #include "clang/Driver/Compilation.h" 13 #include "llvm/Option/ArgList.h" 14 15 using namespace clang::driver; 16 using namespace clang::driver::toolchains; 17 using namespace clang::driver::tools; 18 using namespace clang; 19 using namespace llvm::opt; 20 21 /// AVR Toolchain 22 AVRToolChain::AVRToolChain(const Driver &D, const llvm::Triple &Triple, 23 const ArgList &Args) 24 : Generic_ELF(D, Triple, Args) { } 25 Tool *AVRToolChain::buildLinker() const { 26 return new tools::AVR::Linker(*this); 27 } 28 29 void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA, 30 const InputInfo &Output, 31 const InputInfoList &Inputs, 32 const ArgList &Args, 33 const char *LinkingOutput) const { 34 35 std::string Linker = getToolChain().GetProgramPath(getShortName()); 36 ArgStringList CmdArgs; 37 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); 38 CmdArgs.push_back("-o"); 39 CmdArgs.push_back(Output.getFilename()); 40 C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker), 41 CmdArgs, Inputs)); 42 } 43 // AVR tools end. 44