1//===- Reader.h -------------------------------------------------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef LLVM_TOOLS_OBJCOPY_COFF_READER_H 10#define LLVM_TOOLS_OBJCOPY_COFF_READER_H 11 12#include "Buffer.h" 13#include "llvm/BinaryFormat/COFF.h" 14#include "llvm/Object/COFF.h" 15#include "llvm/Support/Error.h" 16 17namespace llvm { 18namespace objcopy { 19namespace coff { 20 21struct Object; 22 23using object::COFFObjectFile; 24 25class COFFReader { 26 const COFFObjectFile &COFFObj; 27 28 Error readExecutableHeaders(Object &Obj) const; 29 Error readSections(Object &Obj) const; 30 Error readSymbols(Object &Obj, bool IsBigObj) const; 31 Error setSymbolTargets(Object &Obj) const; 32 33public: 34 explicit COFFReader(const COFFObjectFile &O) : COFFObj(O) {} 35 Expected<std::unique_ptr<Object>> create() const; 36}; 37 38} // end namespace coff 39} // end namespace objcopy 40} // end namespace llvm 41 42#endif // LLVM_TOOLS_OBJCOPY_COFF_READER_H 43