1 //===- HexagonRelocator.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 HEXAGON_RELOCATION_FACTORY_H 10 #define HEXAGON_RELOCATION_FACTORY_H 11 #ifdef ENABLE_UNITTEST 12 #include <gtest.h> 13 #endif 14 15 #include <mcld/LD/Relocator.h> 16 #include <mcld/Target/GOT.h> 17 #include <mcld/Target/PLT.h> 18 #include <mcld/Target/SymbolEntryMap.h> 19 #include "HexagonLDBackend.h" 20 21 namespace mcld { 22 23 class ResolveInfo; 24 25 /** \class HexagonRelocator 26 * \brief HexagonRelocator creates and destroys the Hexagon relocations. 27 * 28 */ 29 class HexagonRelocator : public Relocator 30 { 31 public: 32 typedef SymbolEntryMap<PLTEntryBase> SymPLTMap; 33 typedef SymbolEntryMap<HexagonGOTEntry> SymGOTMap; 34 35 public: 36 HexagonRelocator(HexagonLDBackend& pParent); 37 ~HexagonRelocator(); 38 39 Result applyRelocation(Relocation& pRelocation); 40 41 HexagonLDBackend& getTarget() 42 { return m_Target; } 43 44 const HexagonLDBackend& getTarget() const 45 { return m_Target; } 46 47 const char* getName(Relocation::Type pType) const; 48 49 Size getSize(Relocation::Type pType) const; 50 51 const SymPLTMap& getSymPLTMap() const { return m_SymPLTMap; } 52 SymPLTMap& getSymPLTMap() { return m_SymPLTMap; } 53 54 const SymGOTMap& getSymGOTMap() const { return m_SymGOTMap; } 55 SymGOTMap& getSymGOTMap() { return m_SymGOTMap; } 56 57 private: 58 HexagonLDBackend& m_Target; 59 SymPLTMap m_SymPLTMap; 60 SymGOTMap m_SymGOTMap; 61 }; 62 63 } // namespace of mcld 64 65 #endif 66 67