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