blob: 0a6b17adeac6565903f37a575c4952ba8ceee55e [file] [log] [blame]
Martin Storsjoe84a0b52018-12-19 07:24:38 +00001//===- Reader.h -------------------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_TOOLS_OBJCOPY_COFF_READER_H
11#define LLVM_TOOLS_OBJCOPY_COFF_READER_H
12
13#include "Buffer.h"
14#include "llvm/BinaryFormat/COFF.h"
15#include "llvm/Object/COFF.h"
16
17namespace llvm {
18namespace objcopy {
19namespace coff {
20
21class Object;
22
23using object::COFFObjectFile;
24
25class Reader {
26public:
27 virtual ~Reader();
28 virtual std::unique_ptr<Object> create() const = 0;
29};
30
31class COFFReader : public Reader {
32 const COFFObjectFile &COFFObj;
33
34 void readExecutableHeaders(Object &Obj) const;
35 void readSections(Object &Obj) const;
36 void readSymbols(Object &Obj, bool IsBigObj) const;
37
38public:
39 explicit COFFReader(const COFFObjectFile &O) : COFFObj(O) {}
40 std::unique_ptr<Object> create() const override;
41};
42
43} // end namespace coff
44} // end namespace objcopy
45} // end namespace llvm
46
47#endif // LLVM_TOOLS_OBJCOPY_COFF_READER_H