LLVM 23.0.0git
ObjCopy.h
Go to the documentation of this file.
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
13#include "llvm/Support/Error.h"
14
15namespace llvm {
16class raw_ostream;
17
18namespace object {
19class Archive;
20class Binary;
21} // end namespace object
22
23namespace objcopy {
25
26/// Returns the format name of \p B if it is an ObjectFile, or "" otherwise.
27LLVM_ABI StringRef getObjectFormatName(const object::Binary &B);
28
29/// Prints information about the input and output files involved in a copy
30/// operation to stdout.
31LLVM_ABI void printCopyMessage(StringRef InPath, StringRef InFormatName,
32 StringRef OutPath, StringRef OutFormatName);
33
34/// Applies the transformations described by \p Config to
35/// each member in archive \p Ar.
36/// Writes a result in a file specified by \p Config.OutputFilename.
37/// \returns any Error encountered whilst performing the operation.
39 const object::Archive &Ar);
40
41/// Applies the transformations described by \p Config to \p In and writes
42/// the result into \p Out. This function does the dispatch based on the
43/// format of the input binary (COFF, ELF, MachO or wasm).
44/// \returns any Error encountered whilst performing the operation.
46 object::Binary &In, raw_ostream &Out);
47
48} // end namespace objcopy
49} // end namespace llvm
50
51#endif // LLVM_OBJCOPY_OBJCOPY_H
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
LLVM_ABI StringRef getObjectFormatName(const object::Binary &B)
Returns the format name of B if it is an ObjectFile, or "" otherwise.
Definition ObjCopy.cpp:35
LLVM_ABI void printCopyMessage(StringRef InPath, StringRef InFormatName, StringRef OutPath, StringRef OutFormatName)
Prints information about the input and output files involved in a copy operation to stdout.
Definition ObjCopy.cpp:41
LLVM_ABI Error executeObjcopyOnBinary(const MultiFormatConfig &Config, object::Binary &In, raw_ostream &Out)
Applies the transformations described by Config to In and writes the result into Out.
Definition ObjCopy.cpp:51
LLVM_ABI Error executeObjcopyOnArchive(const MultiFormatConfig &Config, const object::Archive &Ar)
Applies the transformations described by Config to each member in archive Ar.
Definition Archive.cpp:108
This is an optimization pass for GlobalISel generic memory operations.