1 //===- MipsRelocationFactory.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/RelocationFactory.h> 16 #include <mcld/Support/GCFactory.h> 17 #include "MipsLDBackend.h" 18 19 namespace mcld 20 { 21 22 /** \class MipsRelocationFactory 23 * \brief MipsRelocationFactory creates and destroys the Mips relocations. 24 */ 25 class MipsRelocationFactory : public RelocationFactory 26 { 27 public: 28 MipsRelocationFactory(size_t pNum, MipsGNULDBackend& pParent); 29 30 Result applyRelocation(Relocation& pRelocation, const MCLDInfo& pLDInfo); 31 32 MipsGNULDBackend& getTarget() 33 { return m_Target; } 34 35 const MipsGNULDBackend& getTarget() const 36 { return m_Target; } 37 38 // Get last calculated AHL. 39 int32_t getAHL() const 40 { return m_AHL; } 41 42 // Set last calculated AHL. 43 void setAHL(int32_t pAHL) 44 { m_AHL = pAHL; } 45 46 const char* getName(Relocation::Type pType) const; 47 48 private: 49 MipsGNULDBackend& m_Target; 50 int32_t m_AHL; 51 }; 52 53 } // namespace of mcld 54 55 #endif 56