aboutsummaryrefslogtreecommitdiff
path: root/lib/ReaderWriter/ELF/Writer.h
blob: 8b3e8f90638a21b0c4db2439fc291d589332a718 (plain) (blame)
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
//===- 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:
  /// \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
  std::error_code writeFile(const File &file, StringRef path) override = 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 // LLD_READER_WRITER_ELF_WRITER_H