1 //===- Stub.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 10 #include <mcld/Fragment/Stub.h> 11 12 using namespace mcld; 13 14 Stub::Stub() 15 : Fragment(Fragment::Stub), 16 m_pSymInfo(NULL) 17 { 18 } 19 20 Stub::~Stub() 21 { 22 for (fixup_iterator fixup= fixup_begin(); fixup != fixup_end(); ++fixup) 23 delete(*fixup); 24 } 25 26 void Stub::setSymInfo(ResolveInfo* pSymInfo) 27 { 28 m_pSymInfo = pSymInfo; 29 } 30 31 void Stub::addFixup(DWord pOffset, SWord pAddend, Type pType) 32 { 33 assert(pOffset < size()); 34 m_FixupList.push_back(new Fixup(pOffset, pAddend, pType)); 35 } 36 37 void Stub::addFixup(const Fixup& pFixup) 38 { 39 assert(pFixup.offset() < size()); 40 m_FixupList.push_back(new Fixup(pFixup)); 41 } 42 43