1 //===- MipsRelocator.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 MIPS_RELOCATION_FACTORY_H 10 #define MIPS_RELOCATION_FACTORY_H 11 #ifdef ENABLE_UNITTEST 12 #include <gtest.h> 13 #endif 14 15 #include <mcld/LD/Relocator.h> 16 #include <mcld/Support/GCFactory.h> 17 #include <mcld/Target/SymbolEntryMap.h> 18 #include "MipsLDBackend.h" 19 20 namespace mcld { 21 22 /** \class MipsRelocator 23 * \brief MipsRelocator creates and destroys the Mips relocations. 24 */ 25 class MipsRelocator : public Relocator 26 { 27 public: 28 typedef SymbolEntryMap<MipsGOTEntry> SymGOTMap; 29 30 public: 31 MipsRelocator(MipsGNULDBackend& pParent); 32 33 Result applyRelocation(Relocation& pRelocation); 34 35 MipsGNULDBackend& getTarget() 36 { return m_Target; } 37 38 const MipsGNULDBackend& getTarget() const 39 { return m_Target; } 40 41 // Get last calculated AHL. 42 int32_t getAHL() const 43 { return m_AHL; } 44 45 // Set last calculated AHL. 46 void setAHL(int32_t pAHL) 47 { m_AHL = pAHL; } 48 49 const char* getName(Relocation::Type pType) const; 50 51 Size getSize(Relocation::Type pType) const; 52 53 const SymGOTMap& getSymGOTMap() const { return m_SymGOTMap; } 54 SymGOTMap& getSymGOTMap() { return m_SymGOTMap; } 55 56 private: 57 MipsGNULDBackend& m_Target; 58 int32_t m_AHL; 59 SymGOTMap m_SymGOTMap; 60 }; 61 62 } // namespace of mcld 63 64 #endif 65