1 //===- Module.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/Module.h> 10 #include <mcld/Fragment/FragmentRef.h> 11 #include <mcld/LD/LDSection.h> 12 #include <mcld/LD/LDSymbol.h> 13 #include <mcld/LD/NamePool.h> 14 #include <mcld/LD/ResolveInfo.h> 15 #include <mcld/LD/SectionData.h> 16 #include <mcld/LD/EhFrame.h> 17 #include <mcld/LD/StaticResolver.h> 18 19 using namespace mcld; 20 21 //===----------------------------------------------------------------------===// 22 // Module 23 //===----------------------------------------------------------------------===// 24 Module::Module() 25 : m_NamePool(1024) { 26 } 27 28 Module::Module(const std::string& pName) 29 : m_Name(pName), m_NamePool(1024) { 30 } 31 32 Module::~Module() 33 { 34 } 35 36 // Following two functions will be obsolette when we have new section merger. 37 LDSection* Module::getSection(const std::string& pName) 38 { 39 iterator sect, sectEnd = end(); 40 for (sect = begin(); sect != sectEnd; ++sect) { 41 if ((*sect)->name() == pName) 42 return *sect; 43 } 44 return NULL; 45 } 46 47 const LDSection* Module::getSection(const std::string& pName) const 48 { 49 const_iterator sect, sectEnd = end(); 50 for (sect = begin(); sect != sectEnd; ++sect) { 51 if ((*sect)->name() == pName) 52 return *sect; 53 } 54 return NULL; 55 } 56 57