blob: 89e926af567e93181fbd99a33ac1d1ec9f4cd2c0 [file] [log] [blame]
Martin Storsjoe84a0b52018-12-19 07:24:38 +00001//===- COFFObjcopy.cpp ----------------------------------------------------===//
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#include "COFFObjcopy.h"
11#include "Buffer.h"
12#include "CopyConfig.h"
13#include "Object.h"
14#include "Reader.h"
15#include "Writer.h"
16#include "llvm-objcopy.h"
17
18#include "llvm/Object/Binary.h"
19#include "llvm/Object/COFF.h"
20#include <cassert>
21
22namespace llvm {
23namespace objcopy {
24namespace coff {
25
26using namespace object;
27using namespace COFF;
28
29void executeObjcopyOnBinary(const CopyConfig &Config,
30 object::COFFObjectFile &In, Buffer &Out) {
31 COFFReader Reader(In);
32 std::unique_ptr<Object> Obj = Reader.create();
33 assert(Obj && "Unable to deserialize COFF object");
34 COFFWriter Writer(*Obj, Out);
35 Writer.write();
36}
37
38} // end namespace coff
39} // end namespace objcopy
40} // end namespace llvm