blob: c4e5aebf22b1b702ff8ee0bb03fa694f77140198 [file] [log] [blame]
Stephen Hinesf33f6de2014-02-14 18:00:16 -08001//===- OutputCmd.cpp -----------------------------------------------------===//
2//
3// The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Stephen Hines37b74a32014-11-26 18:48:20 -08009#include "mcld/Script/OutputCmd.h"
10#include "mcld/Support/raw_ostream.h"
11#include "mcld/LinkerScript.h"
12#include "mcld/Module.h"
Stephen Hinesf33f6de2014-02-14 18:00:16 -080013
Stephen Hines37b74a32014-11-26 18:48:20 -080014namespace mcld {
Stephen Hinesf33f6de2014-02-14 18:00:16 -080015
16//===----------------------------------------------------------------------===//
17// OutputCmd
18//===----------------------------------------------------------------------===//
19OutputCmd::OutputCmd(const std::string& pOutputFile)
Stephen Hines37b74a32014-11-26 18:48:20 -080020 : ScriptCommand(ScriptCommand::OUTPUT), m_OutputFile(pOutputFile) {
Stephen Hinesf33f6de2014-02-14 18:00:16 -080021}
22
Stephen Hines37b74a32014-11-26 18:48:20 -080023OutputCmd::~OutputCmd() {
Stephen Hinesf33f6de2014-02-14 18:00:16 -080024}
25
Stephen Hines37b74a32014-11-26 18:48:20 -080026void OutputCmd::dump() const {
Stephen Hinesf33f6de2014-02-14 18:00:16 -080027 mcld::outs() << "OUTPUT ( " << m_OutputFile << " )\n";
28}
29
Stephen Hines37b74a32014-11-26 18:48:20 -080030void OutputCmd::activate(Module& pModule) {
Stephen Hinesf33f6de2014-02-14 18:00:16 -080031 pModule.getScript().setOutputFile(m_OutputFile);
32 // TODO: set the output name if there is no `-o filename' on the cmdline.
33 // This option is to define a default name for the output file other than the
34 // usual default of a.out.
35}
36
Stephen Hines37b74a32014-11-26 18:48:20 -080037} // namespace mcld