summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/ELFWriter.h
blob: 44e547118655f09b922738ecc6c6e956220a853c (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
//===- lib/ReaderWriter/ELF/ELFWriter.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 "ReferenceKinds.h"

#include "lld/Core/File.h"
#include "lld/Core/InputFiles.h"
#include "lld/ReaderWriter/Writer.h"

namespace lld {
namespace elf {
/// \brief The ELFWriter 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 lld::File &file) = 0;

  /// \brief Writes the chunks into the output file specified by path
  virtual error_code writeFile(const lld::File &File, StringRef path) = 0;

  /// \brief Get the virtual address of \p atom after layout.
  virtual uint64_t addressOfAtom(const Atom *atom) = 0;

  /// \brief Return the processing function to apply Relocations
  virtual KindHandler *kindHandler()  = 0;
};

} // elf
} // lld

#endif // LLD_READER_WRITER_ELF_WRITER_H_
OpenPOWER on IntegriCloud