1 //===- ObjCopy.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_OBJCOPY_OBJCOPY_H
10 #define LLVM_OBJCOPY_OBJCOPY_H
11 
12 #include "llvm/Support/Error.h"
13 
14 namespace llvm {
15 class raw_ostream;
16 
17 namespace object {
18 class Archive;
19 class Binary;
20 } // end namespace object
21 
22 namespace objcopy {
23 class MultiFormatConfig;
24 
25 /// Applies the transformations described by \p Config to
26 /// each member in archive \p Ar.
27 /// Writes a result in a file specified by \p Config.OutputFilename.
28 /// \returns any Error encountered whilst performing the operation.
29 Error executeObjcopyOnArchive(const MultiFormatConfig &Config,
30                               const object::Archive &Ar);
31 
32 /// Applies the transformations described by \p Config to \p In and writes
33 /// the result into \p Out. This function does the dispatch based on the
34 /// format of the input binary (COFF, ELF, MachO or wasm).
35 /// \returns any Error encountered whilst performing the operation.
36 Error executeObjcopyOnBinary(const MultiFormatConfig &Config,
37                              object::Binary &In, raw_ostream &Out);
38 
39 } // end namespace objcopy
40 } // end namespace llvm
41 
42 #endif // LLVM_OBJCOPY_OBJCOPY_H
43