ARMRelocator.h revision 6f75755c9204b1d8817ae5a65a2f7e5af0ec3f70
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 20namespace mcld { 21 22/** \class ARMRelocator 23 * \brief ARMRelocator creates and destroys the ARM relocations. 24 * 25 */ 26class ARMRelocator : public Relocator 27{ 28public: 29 typedef SymbolEntryMap<ARMGOTEntry> SymGOTMap; 30 typedef SymbolEntryMap<ARMPLT1> SymPLTMap; 31 32public: 33 ARMRelocator(ARMGNULDBackend& pParent); 34 ~ARMRelocator(); 35 36 Result applyRelocation(Relocation& pRelocation); 37 38 ARMGNULDBackend& getTarget() 39 { return m_Target; } 40 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 48 const SymGOTMap& getSymGOTMap() const { return m_SymGOTMap; } 49 SymGOTMap& getSymGOTMap() { return m_SymGOTMap; } 50 51 const SymPLTMap& getSymPLTMap() const { return m_SymPLTMap; } 52 SymPLTMap& getSymPLTMap() { return m_SymPLTMap; } 53 54 const SymGOTMap& getSymGOTPLTMap() const { return m_SymGOTPLTMap; } 55 SymGOTMap& getSymGOTPLTMap() { return m_SymGOTPLTMap; } 56 57private: 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