summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86GOTPLT.h
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2012-03-16 22:41:16 -0700
committerShih-wei Liao <sliao@google.com>2012-03-17 03:32:25 -0700
commit5460a1f25d9ddecb5c70667267d66d51af177a99 (patch)
treed8a34be7ba631b703d871e4167f2ea5cab3910a2 /lib/Target/X86/X86GOTPLT.h
parent7a83dfa572a3ae9da136c30c62f6d6cdab3dd064 (diff)
downloadmclinker-5460a1f25d9ddecb5c70667267d66d51af177a99.tar.gz
Linkloader improvement: mclinker.
Change-Id: I8805e39ccbc2ee204234fb3e71c70c906f3990bb
Diffstat (limited to 'lib/Target/X86/X86GOTPLT.h')
-rw-r--r--lib/Target/X86/X86GOTPLT.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/lib/Target/X86/X86GOTPLT.h b/lib/Target/X86/X86GOTPLT.h
new file mode 100644
index 0000000..9882cc4
--- /dev/null
+++ b/lib/Target/X86/X86GOTPLT.h
@@ -0,0 +1,70 @@
+//===- X86GOTPLT.h --------------------------------------------------------===//
+//
+// The MCLinker Project
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#ifndef MCLD_X86_GOTPLT_H
+#define MCLD_X86_GOTPLT_H
+#ifdef ENABLE_UNITTEST
+#include <gtest.h>
+#endif
+
+#include "mcld/Target/GOT.h"
+
+namespace mcld
+{
+class LDSection;
+
+/** \class X86GOTPLT
+ * \brief X86 .got.plt section.
+ */
+
+const unsigned int X86GOT0Num = 3;
+
+class X86GOTPLT : public GOT
+{
+ typedef llvm::DenseMap<const ResolveInfo*, GOTEntry*> SymbolIndexMapType;
+
+public:
+ typedef llvm::MCSectionData::iterator iterator;
+ typedef llvm::MCSectionData::const_iterator const_iterator;
+
+public:
+ X86GOTPLT(LDSection &pSection, llvm::MCSectionData& pSectionData);
+
+ ~X86GOTPLT();
+
+ iterator begin();
+
+ const_iterator begin() const;
+
+ iterator end();
+
+ const_iterator end() const;
+
+// For GOT0
+public:
+ void applyGOT0(const uint64_t pAddress);
+
+// For GOTPLT
+public:
+ void reserveGOTPLTEntry();
+
+ void applyAllGOTPLT(const uint64_t pPLTBase);
+
+ GOTEntry*& lookupGOTPLTMap(const ResolveInfo& pSymbol);
+
+ iterator getNextGOTPLTEntry();
+
+private:
+ iterator m_GOTPLTIterator;
+ SymbolIndexMapType m_GOTPLTMap;
+};
+
+} // namespace of mcld
+
+#endif
+