summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsGOTPLT.h
blob: 9220f8d6da79553a6c2a424b957258eabdc2ff76 (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
//===- MipsGOTPLT.h -------------------------------------------------------===//
//
//                     The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef TARGET_MIPS_MIPSGOTPLT_H
#define TARGET_MIPS_MIPSGOTPLT_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif

#include <mcld/Target/GOT.h>
#include <mcld/Support/MemoryRegion.h>
#include <llvm/ADT/DenseMap.h>

namespace mcld {

class LDSection;

/** \class MipsGOTPLT
 *  \brief Mips .got.plt section.
 */
class MipsGOTPLT : public GOT
{
public:
  MipsGOTPLT(LDSection &pSection);

  // hasGOT1 - return if this section has any GOT1 entry
  bool hasGOT1() const;

  uint64_t getEntryAddr(size_t num) const;

  uint64_t emit(MemoryRegion& pRegion);

  Fragment* consume();

  void applyAllGOTPLT(uint64_t pltAddr);

public:
  // GOT
  void reserve(size_t pNum = 1);

private:
  // the last consumed entry.
  SectionData::iterator m_Last;
};

} // namespace of mcld

#endif