1 | |
2 | |
3 | |
4 | |
5 | |
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 | |
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 | |
44 | |