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