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