1 //===- ARMRelocator.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 ARM_RELOCATION_FACTORY_H 10 #define ARM_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/SymbolEntryMap.h> 18 #include "ARMLDBackend.h" 19 20 namespace mcld { 21 22 /** \class ARMRelocator 23 * \brief ARMRelocator creates and destroys the ARM relocations. 24 * 25 */ 26 class ARMRelocator : public Relocator 27 { 28 public: 29 typedef SymbolEntryMap<ARMGOTEntry> SymGOTMap; 30 typedef SymbolEntryMap<ARMPLT1> SymPLTMap; 31 32 public: 33 ARMRelocator(ARMGNULDBackend& pParent); 34 ~ARMRelocator(); 35 36 Result applyRelocation(Relocation& pRelocation); 37 getTarget()38 ARMGNULDBackend& getTarget() 39 { return m_Target; } 40 getTarget()41 const ARMGNULDBackend& getTarget() const 42 { return m_Target; } 43 44 const char* getName(Relocation::Type pType) const; 45 46 Size getSize(Relocation::Type pType) const; 47 getSymGOTMap()48 const SymGOTMap& getSymGOTMap() const { return m_SymGOTMap; } getSymGOTMap()49 SymGOTMap& getSymGOTMap() { return m_SymGOTMap; } 50 getSymPLTMap()51 const SymPLTMap& getSymPLTMap() const { return m_SymPLTMap; } getSymPLTMap()52 SymPLTMap& getSymPLTMap() { return m_SymPLTMap; } 53 getSymGOTPLTMap()54 const SymGOTMap& getSymGOTPLTMap() const { return m_SymGOTPLTMap; } getSymGOTPLTMap()55 SymGOTMap& getSymGOTPLTMap() { return m_SymGOTPLTMap; } 56 57 private: 58 ARMGNULDBackend& m_Target; 59 SymGOTMap m_SymGOTMap; 60 SymPLTMap m_SymPLTMap; 61 SymGOTMap m_SymGOTPLTMap; 62 }; 63 64 } // namespace of mcld 65 66 #endif 67 68