blob: 877009af8a3076c9beeba77505b0106b1217c690 [file] [log] [blame]
David L. Jonesf561aba2017-03-08 01:02:16 +00001//===--- AVR.cpp - AVR ToolChain Implementations ----------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "AVR.h"
11#include "CommonArgs.h"
12#include "InputInfo.h"
13#include "clang/Driver/Compilation.h"
14#include "llvm/Option/ArgList.h"
15
16using namespace clang::driver;
17using namespace clang::driver::toolchains;
18using namespace clang::driver::tools;
19using namespace clang;
20using namespace llvm::opt;
21
22/// AVR Toolchain
23AVRToolChain::AVRToolChain(const Driver &D, const llvm::Triple &Triple,
24 const ArgList &Args)
25 : Generic_ELF(D, Triple, Args) { }
26Tool *AVRToolChain::buildLinker() const {
27 return new tools::AVR::Linker(*this);
28}
29
30void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA,
31 const InputInfo &Output,
32 const InputInfoList &Inputs,
33 const ArgList &Args,
34 const char *LinkingOutput) const {
35
36 std::string Linker = getToolChain().GetProgramPath(getShortName());
37 ArgStringList CmdArgs;
38 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
39 CmdArgs.push_back("-o");
40 CmdArgs.push_back(Output.getFilename());
41 C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
42 CmdArgs, Inputs));
43}
44// AVR tools end.