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