1 //===- THMToARMStub.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 TARGET_ARM_THMTOARMSTUB_H_ 10 #define TARGET_ARM_THMTOARMSTUB_H_ 11 12 #include "mcld/Fragment/Stub.h" 13 #include <llvm/Support/DataTypes.h> 14 #include <string> 15 16 namespace mcld { 17 18 class Relocation; 19 class ResolveInfo; 20 21 /** \class THMToARMStub 22 * \brief ARM stub for long call from ARM source to ARM target 23 * 24 */ 25 class THMToARMStub : public Stub { 26 public: 27 THMToARMStub(bool pIsOutputPIC, bool pUsingThumb2); 28 29 ~THMToARMStub(); 30 31 // isMyDuty 32 bool isMyDuty(const class Relocation& pReloc, 33 uint64_t pSource, 34 uint64_t pTargetSymValue) const; 35 36 // observers 37 const std::string& name() const; 38 39 const uint8_t* getContent() const; 40 41 size_t size() const; 42 43 size_t alignment() const; 44 45 // for T bit of this stub 46 uint64_t initSymValue() const; 47 48 private: 49 THMToARMStub(const THMToARMStub&); 50 51 THMToARMStub& operator=(const THMToARMStub&); 52 53 /// for doClone 54 THMToARMStub(const uint32_t* pData, 55 size_t pSize, 56 const_fixup_iterator pBegin, 57 const_fixup_iterator pEnd, 58 bool pUsingThumb2); 59 60 /// doClone 61 Stub* doClone(); 62 63 private: 64 static const uint32_t PIC_TEMPLATE[]; 65 static const uint32_t TEMPLATE[]; 66 const uint32_t* m_pData; 67 std::string m_Name; 68 size_t m_Size; 69 bool m_bUsingThumb2; 70 }; 71 72 } // namespace mcld 73 74 #endif // TARGET_ARM_THMTOARMSTUB_H_ 75