1//===- EntryCmd.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//===----------------------------------------------------------------------===//
9#include <mcld/Script/EntryCmd.h>
10#include <mcld/Support/raw_ostream.h>
11#include <mcld/LinkerScript.h>
12#include <mcld/Module.h>
13
14using namespace mcld;
15
16//===----------------------------------------------------------------------===//
17// EntryCmd
18//===----------------------------------------------------------------------===//
19EntryCmd::EntryCmd(const std::string& pEntry)
20  : ScriptCommand(ScriptCommand::ENTRY),
21    m_Entry(pEntry)
22{
23}
24
25EntryCmd::~EntryCmd()
26{
27}
28
29void EntryCmd::dump() const
30{
31  mcld::outs() << "ENTRY ( " << m_Entry << " )\n";
32}
33
34void EntryCmd::activate(Module& pModule)
35{
36  LinkerScript& script = pModule.getScript();
37  if (!script.hasEntry())
38    script.setEntry(m_Entry);
39}
40
41