Path: blob/main/contrib/llvm-project/llvm/lib/ObjCopy/XCOFF/XCOFFObjcopy.cpp
35267 views
//===- XCOFFObjcopy.cpp ---------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/ObjCopy/CommonConfig.h"9#include "llvm/ObjCopy/XCOFF/XCOFFConfig.h"10#include "llvm/ObjCopy/XCOFF/XCOFFObjcopy.h"11#include "llvm/Support/Errc.h"12#include "XCOFFObject.h"13#include "XCOFFReader.h"14#include "XCOFFWriter.h"1516namespace llvm {17namespace objcopy {18namespace xcoff {1920using namespace object;2122static Error handleArgs(const CommonConfig &Config, Object &Obj) {23return Error::success();24}2526Error executeObjcopyOnBinary(const CommonConfig &Config, const XCOFFConfig &,27XCOFFObjectFile &In, raw_ostream &Out) {28XCOFFReader Reader(In);29Expected<std::unique_ptr<Object>> ObjOrErr = Reader.create();30if (!ObjOrErr)31return createFileError(Config.InputFilename, ObjOrErr.takeError());32Object *Obj = ObjOrErr->get();33assert(Obj && "Unable to deserialize XCOFF object");34if (Error E = handleArgs(Config, *Obj))35return createFileError(Config.InputFilename, std::move(E));36XCOFFWriter Writer(*Obj, Out);37if (Error E = Writer.write())38return createFileError(Config.OutputFilename, std::move(E));39return Error::success();40}4142} // end namespace xcoff43} // end namespace objcopy44} // end namespace llvm454647