Martin Storsjo | e84a0b5 | 2018-12-19 07:24:38 +0000 | [diff] [blame^] | 1 | //===- 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 | |
| 17 | namespace llvm { |
| 18 | namespace objcopy { |
| 19 | namespace coff { |
| 20 | |
| 21 | class Object; |
| 22 | |
| 23 | using object::COFFObjectFile; |
| 24 | |
| 25 | class Reader { |
| 26 | public: |
| 27 | virtual ~Reader(); |
| 28 | virtual std::unique_ptr<Object> create() const = 0; |
| 29 | }; |
| 30 | |
| 31 | class 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 | |
| 38 | public: |
| 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 |