summaryrefslogtreecommitdiff
path: root/lib/ReaderWriter/ELF/Writer.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ReaderWriter/ELF/Writer.h')
-rw-r--r--lib/ReaderWriter/ELF/Writer.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/ReaderWriter/ELF/Writer.h b/lib/ReaderWriter/ELF/Writer.h
new file mode 100644
index 0000000000000..1e819467c558f
--- /dev/null
+++ b/lib/ReaderWriter/ELF/Writer.h
@@ -0,0 +1,38 @@
+//===- lib/ReaderWriter/ELF/Writer.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_WRITER_H
+#define LLD_READER_WRITER_ELF_WRITER_H
+
+#include "lld/Core/File.h"
+#include "lld/Core/Writer.h"
+
+namespace lld {
+namespace elf {
+/// \brief The Writer class is a base class for the linker to write
+/// various kinds of ELF files.
+class ELFWriter : public Writer {
+public:
+ ELFWriter() { }
+
+public:
+ /// \brief builds the chunks that needs to be written to the output
+ /// ELF file
+ virtual void buildChunks(const File &file) = 0;
+
+ /// \brief Writes the chunks into the output file specified by path
+ virtual std::error_code writeFile(const File &file, StringRef path) = 0;
+
+ /// \brief Get the virtual address of \p atom after layout.
+ virtual uint64_t addressOfAtom(const Atom *atom) = 0;
+};
+} // end namespace elf
+} // end namespace lld
+
+#endif