blob: 1f2d1180e46953d324469e46938ec07aad288e6c [file] [log] [blame]
Alexander Shaposhnikovd911ed12019-02-02 00:38:07 +00001//===- MachOObjcopy.cpp -----------------------------------------*- 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#include "MachOObjcopy.h"
11#include "../CopyConfig.h"
12#include "../llvm-objcopy.h"
13#include "MachOReader.h"
14#include "MachOWriter.h"
15#include "llvm/Support/Error.h"
16
17namespace llvm {
18namespace objcopy {
19namespace macho {
20
21Error executeObjcopyOnBinary(const CopyConfig &Config,
22 object::MachOObjectFile &In, Buffer &Out) {
23 MachOReader Reader(In);
24 std::unique_ptr<Object> O = Reader.create();
25 assert(O && "Unable to deserialize MachO object");
26 MachOWriter Writer(*O, In.is64Bit(), In.isLittleEndian(), Out);
27 return Writer.write();
28}
29
30} // end namespace macho
31} // end namespace objcopy
32} // end namespace llvm