• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- ARMPLT.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 MCLD_ARM_PLT_H
10 #define MCLD_ARM_PLT_H
11 
12 #include <mcld/Target/PLT.h>
13 
14 namespace mcld {
15 
16 class ARMGOT;
17 class GOTEntry;
18 class MemoryRegion;
19 
20 class ARMPLT0 : public PLTEntry {
21 public:
22   ARMPLT0(llvm::MCSectionData* pParent);
23 };
24 
25 class ARMPLT1 : public PLTEntry {
26 public:
27   ARMPLT1(llvm::MCSectionData* pParent);
28 };
29 
30 /** \class ARMPLT
31  *  \brief ARM Procedure Linkage Table
32  */
33 class ARMPLT : public PLT
34 {
35   typedef llvm::DenseMap<const ResolveInfo*, ARMPLT1*> SymbolIndexType;
36 
37 public:
38   typedef llvm::MCSectionData::iterator iterator;
39   typedef llvm::MCSectionData::const_iterator const_iterator;
40 
41 public:
42   ARMPLT(LDSection& pSection,
43          llvm::MCSectionData& pSectionData,
44          ARMGOT& pGOTPLT);
45   ~ARMPLT();
46 
47 // Override virtual function.
48 public:
49 
50   // reserveEntry is ARMGOT friend function.
51   void reserveEntry(size_t pNum = 1) ;
52 
53   PLTEntry* getPLTEntry(const ResolveInfo& pSymbol, bool& pExist) ;
54 
55   GOTEntry* getGOTPLTEntry(const ResolveInfo& pSymbol, bool& pExist);
56 
57 public:
begin()58   iterator begin() { return m_SectionData.begin(); }
59 
begin()60   const_iterator begin() const { return m_SectionData.begin(); }
61 
end()62   iterator end() { return m_SectionData.end(); }
63 
end()64   const_iterator end() const { return m_SectionData.end(); }
65 
66   ARMPLT0* getPLT0() const;
67 
68   void applyPLT0();
69 
70   void applyPLT1();
71 
72   uint64_t emit(MemoryRegion& pRegion);
73 
74 private:
75   ARMGOT& m_GOT;
76 
77   // Used by getEntry() for mapping a ResolveInfo
78   // instance to a PLT1 Entry.
79   iterator m_PLTEntryIterator;
80 
81   SymbolIndexType m_PLTEntryMap;
82 };
83 
84 } // namespace of mcld
85 
86 #endif
87