2018-12-19 08:24:38 +01:00
|
|
|
//===- Reader.h -------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-12-19 08:24:38 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TOOLS_OBJCOPY_COFF_READER_H
|
|
|
|
#define LLVM_TOOLS_OBJCOPY_COFF_READER_H
|
|
|
|
|
|
|
|
#include "llvm/BinaryFormat/COFF.h"
|
|
|
|
#include "llvm/Object/COFF.h"
|
2018-12-30 21:35:43 +01:00
|
|
|
#include "llvm/Support/Error.h"
|
2018-12-19 08:24:38 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace objcopy {
|
|
|
|
namespace coff {
|
|
|
|
|
2018-12-19 08:45:06 +01:00
|
|
|
struct Object;
|
2018-12-19 08:24:38 +01:00
|
|
|
|
|
|
|
using object::COFFObjectFile;
|
|
|
|
|
2019-01-12 09:30:09 +01:00
|
|
|
class COFFReader {
|
2018-12-19 08:24:38 +01:00
|
|
|
const COFFObjectFile &COFFObj;
|
|
|
|
|
2018-12-30 21:35:43 +01:00
|
|
|
Error readExecutableHeaders(Object &Obj) const;
|
|
|
|
Error readSections(Object &Obj) const;
|
|
|
|
Error readSymbols(Object &Obj, bool IsBigObj) const;
|
2019-01-22 11:58:09 +01:00
|
|
|
Error setSymbolTargets(Object &Obj) const;
|
2018-12-19 08:24:38 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit COFFReader(const COFFObjectFile &O) : COFFObj(O) {}
|
2019-01-12 09:30:09 +01:00
|
|
|
Expected<std::unique_ptr<Object>> create() const;
|
2018-12-19 08:24:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace coff
|
|
|
|
} // end namespace objcopy
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif // LLVM_TOOLS_OBJCOPY_COFF_READER_H
|