blob: 750659ab51e409252820d19aa604c45b39280149 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
//===- ARMGOT.h -----------------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef TARGET_ARM_ARMGOT_H
#define TARGET_ARM_ARMGOT_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif
#include <mcld/Target/GOT.h>
#include <mcld/Support/MemoryRegion.h>
#include <llvm/ADT/DenseMap.h>
#include <vector>
namespace mcld {
class LDSection;
/** \class ARMGOTEntry
* \brief GOT Entry with size of 4 bytes
*/
class ARMGOTEntry : public GOT::Entry<4>
{
public:
ARMGOTEntry(uint64_t pContent, SectionData* pParent)
: GOT::Entry<4>(pContent, pParent)
{}
};
/** \class ARMGOT
* \brief ARM Global Offset Table.
*
* ARM GOT integrates traditional .got.plt and .got sections into one.
* Traditional .got.plt is placed in the front part of GOT (PLTGOT), and
* traditional .got is placed in the rear part of GOT (GOT).
*
* ARM .got
* +--------------+
* | GOT0 |
* +--------------+
* | GOTPLT |
* +--------------+
* | GOT |
* +--------------+
*
*/
class ARMGOT : public GOT
{
public:
ARMGOT(LDSection &pSection);
~ARMGOT();
ARMGOTEntry* createGOT();
ARMGOTEntry* createGOTPLT();
void finalizeSectionSize();
uint64_t emit(MemoryRegion& pRegion);
void applyGOT0(uint64_t pAddress);
void applyGOTPLT(uint64_t pPLTBase);
bool hasGOT1() const;
private:
typedef std::vector<ARMGOTEntry*> EntryListType;
typedef EntryListType::iterator entry_iterator;
typedef EntryListType::const_iterator const_entry_iterator;
private:
ARMGOTEntry* m_pGOTPLTFront;
ARMGOTEntry* m_pGOTFront;
/// m_GOTPLTEntries - a list of gotplt entries
EntryListType m_GOTPLT;
/// m_GOTEntris - a list of got entries
EntryListType m_GOT;
};
} // namespace of mcld
#endif
|