LLVM 19.0.0git
Go to the documentation of this file.
1//===- XCOFFObjcopy.cpp ---------------------------------------------------===//
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
12#include "llvm/Support/Errc.h"
13#include "XCOFFObject.h"
14#include "XCOFFReader.h"
15#include "XCOFFWriter.h"
17namespace llvm {
18namespace objcopy {
19namespace xcoff {
21using namespace object;
24 return Error::success();
28 XCOFFObjectFile &In, raw_ostream &Out) {
29 XCOFFReader Reader(In);
30 Expected<std::unique_ptr<Object>> ObjOrErr = Reader.create();
31 if (!ObjOrErr)
32 return createFileError(Config.InputFilename, ObjOrErr.takeError());
33 Object *Obj = ObjOrErr->get();
34 assert(Obj && "Unable to deserialize XCOFF object");
35 if (Error E = handleArgs(Config, *Obj))
36 return createFileError(Config.InputFilename, std::move(E));
37 XCOFFWriter Writer(*Obj, Out);
38 if (Error E = Writer.write())
39 return createFileError(Config.OutputFilename, std::move(E));
40 return Error::success();
43} // end namespace xcoff
44} // end namespace objcopy
45} // end namespace llvm
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
RelaxConfig Config
Definition: ELF_riscv.cpp:506
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
Tagged union holding either a T or a Error.
Definition: Error.h:481
Error takeError()
Take ownership of the stored error.
Definition: Error.h:608
reference get()
Returns a reference to the stored T value.
Definition: Error.h:578
Expected< std::unique_ptr< Object > > create() const
Definition: XCOFFReader.cpp:75
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
Error executeObjcopyOnBinary(const CommonConfig &Config, const XCOFFConfig &, object::XCOFFObjectFile &In, raw_ostream &Out)
Apply the transformations described by Config and XCOFFConfig to In and writes the result into Out.
static Error handleArgs(const CommonConfig &Config, Object &Obj)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
Definition: Error.h:1380