Home | History | Annotate | Download | only in Target
      1 //===- OutputRelocSection.h -----------------------------------------------===//
      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 #ifndef MCLD_TARGET_OUTPUTRELOCSECTION_H
     10 #define MCLD_TARGET_OUTPUTRELOCSECTION_H
     11 
     12 #include <mcld/LD/RelocData.h>
     13 
     14 namespace mcld
     15 {
     16 
     17 class LDSymbol;
     18 class Module;
     19 class Relocation;
     20 class RelocationFactory;
     21 
     22 /** \class OutputRelocSection
     23  *  \brief Dynamic relocation section for ARM .rel.dyn and .rel.plt
     24  */
     25 class OutputRelocSection
     26 {
     27 public:
     28   OutputRelocSection(Module& pModule, LDSection& pSection);
     29 
     30   ~OutputRelocSection();
     31 
     32   /// create - create an dynamic relocation entry
     33   Relocation* create();
     34 
     35   void reserveEntry(size_t pNum=1);
     36 
     37   Relocation* consumeEntry();
     38 
     39   /// addSymbolToDynSym - add local symbol to TLS category so that it'll be
     40   /// emitted into .dynsym
     41   bool addSymbolToDynSym(LDSymbol& pSymbol);
     42 
     43   // ----- observers ----- //
     44   bool empty()
     45   { return m_pRelocData->empty(); }
     46 
     47   size_t numOfRelocs();
     48 
     49 private:
     50   typedef RelocData::iterator RelocIterator;
     51 
     52 private:
     53   Module& m_Module;
     54 
     55   /// m_RelocData - the output RelocData which contains the dynamic
     56   /// relocations
     57   RelocData* m_pRelocData;
     58 
     59   /// m_isVisit - First time visit the function getEntry() or not
     60   bool m_isVisit;
     61 
     62   /// m_ValidEntryIterator - point to the first valid entry
     63   RelocIterator m_ValidEntryIterator;
     64 };
     65 
     66 } // namespace of mcld
     67 
     68 #endif
     69 
     70