summaryrefslogtreecommitdiff
path: root/lib/ReaderWriter/ELF/X86/X86LinkingContext.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-03-24 21:31:36 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-03-24 21:31:36 +0000
commitfb911942f1434f3d1750f83f25f5e42c80e60638 (patch)
tree1678c4a4f0182e4029a86d135aa4a1b7d09e3c41 /lib/ReaderWriter/ELF/X86/X86LinkingContext.h
Notes
Diffstat (limited to 'lib/ReaderWriter/ELF/X86/X86LinkingContext.h')
-rw-r--r--lib/ReaderWriter/ELF/X86/X86LinkingContext.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/ReaderWriter/ELF/X86/X86LinkingContext.h b/lib/ReaderWriter/ELF/X86/X86LinkingContext.h
new file mode 100644
index 000000000000..ff424f411aae
--- /dev/null
+++ b/lib/ReaderWriter/ELF/X86/X86LinkingContext.h
@@ -0,0 +1,42 @@
+//===- lib/ReaderWriter/ELF/X86/X86LinkingContext.h -----------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_READER_WRITER_ELF_X86_TARGETINFO_H
+#define LLD_READER_WRITER_ELF_X86_TARGETINFO_H
+
+#include "lld/ReaderWriter/ELFLinkingContext.h"
+#include "llvm/Object/ELF.h"
+#include "llvm/Support/ELF.h"
+
+namespace lld {
+namespace elf {
+class X86LinkingContext final : public ELFLinkingContext {
+public:
+ static std::unique_ptr<ELFLinkingContext> create(llvm::Triple);
+ X86LinkingContext(llvm::Triple);
+
+ /// \brief X86 has only two relative relocation
+ /// a) for supporting IFUNC relocs - R_386_IRELATIVE
+ /// b) for supporting relative relocs - R_386_RELATIVE
+ bool isRelativeReloc(const Reference &r) const override {
+ if (r.kindNamespace() != Reference::KindNamespace::ELF)
+ return false;
+ assert(r.kindArch() == Reference::KindArch::x86);
+ switch (r.kindValue()) {
+ case llvm::ELF::R_386_IRELATIVE:
+ case llvm::ELF::R_386_RELATIVE:
+ return true;
+ default:
+ return false;
+ }
+ }
+};
+} // end namespace elf
+} // end namespace lld
+#endif