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