llvm/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp

//===- ObjcopyOptions.cpp -------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "ObjcopyOptions.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/ObjCopy/CommonConfig.h"
#include "llvm/ObjCopy/ConfigManager.h"
#include "llvm/ObjCopy/MachO/MachOConfig.h"
#include "llvm/Object/Binary.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"

usingnamespacellvm;
usingnamespacellvm::objcopy;
usingnamespacellvm::object;
usingnamespacellvm::opt;

namespace {
enum ObjcopyID {};

namespace objcopy_opt {
#define PREFIX
#include "ObjcopyOpts.inc"
#undef PREFIX

static constexpr opt::OptTable::Info ObjcopyInfoTable[] =;
} // namespace objcopy_opt

class ObjcopyOptTable : public opt::GenericOptTable {};

enum InstallNameToolID {};

namespace install_name_tool {

#define PREFIX
#include "InstallNameToolOpts.inc"
#undef PREFIX

static constexpr opt::OptTable::Info InstallNameToolInfoTable[] =;
} // namespace install_name_tool

class InstallNameToolOptTable : public opt::GenericOptTable {};

enum BitcodeStripID {};

namespace bitcode_strip {

#define PREFIX
#include "BitcodeStripOpts.inc"
#undef PREFIX

static constexpr opt::OptTable::Info BitcodeStripInfoTable[] =;
} // namespace bitcode_strip

class BitcodeStripOptTable : public opt::GenericOptTable {};

enum StripID {};

namespace strip {
#define PREFIX
#include "StripOpts.inc"
#undef PREFIX

static constexpr opt::OptTable::Info StripInfoTable[] =;
} // namespace strip

class StripOptTable : public opt::GenericOptTable {};

} // namespace

static SectionFlag parseSectionRenameFlag(StringRef SectionName) {}

static Expected<SectionFlag>
parseSectionFlagSet(ArrayRef<StringRef> SectionFlags) {}

static Expected<SectionRename> parseRenameSectionValue(StringRef FlagValue) {}

static Expected<std::pair<StringRef, uint64_t>>
parseSetSectionAttribute(StringRef Option, StringRef FlagValue) {}

static Expected<SectionFlagsUpdate>
parseSetSectionFlagValue(StringRef FlagValue) {}

static Expected<uint8_t> parseVisibilityType(StringRef VisType) {}

namespace {
struct TargetInfo {};
} // namespace

// FIXME: consolidate with the bfd parsing used by lld.
static const StringMap<MachineInfo> TargetMap{};

static Expected<TargetInfo>
getOutputTargetInfoByTargetName(StringRef TargetName) {}

static Error addSymbolsFromFile(NameMatcher &Symbols, BumpPtrAllocator &Alloc,
                                StringRef Filename, MatchStyle MS,
                                function_ref<Error(Error)> ErrorCallback) {}

static Error addSymbolsToRenameFromFile(StringMap<StringRef> &SymbolsToRename,
                                        BumpPtrAllocator &Alloc,
                                        StringRef Filename) {}

template <class T> static ErrorOr<T> getAsInteger(StringRef Val) {}

namespace {

enum class ToolType {};

} // anonymous namespace

static void printHelp(const opt::OptTable &OptTable, raw_ostream &OS,
                      ToolType Tool) {}

static Expected<NewSymbolInfo> parseNewSymbolInfo(StringRef FlagValue) {}

// Parse input option \p ArgValue and load section data. This function
// extracts section name and name of the file keeping section data from
// ArgValue, loads data from the file, and stores section name and data
// into the vector of new sections \p NewSections.
static Error loadNewSectionData(StringRef ArgValue, StringRef OptionName,
                                SmallVector<NewSectionInfo, 0> &NewSections) {}

static Expected<int64_t> parseChangeSectionLMA(StringRef ArgValue,
                                               StringRef OptionName) {}

static Expected<SectionPatternAddressUpdate>
parseChangeSectionAddr(StringRef ArgValue, StringRef OptionName,
                       MatchStyle SectionMatchStyle,
                       function_ref<Error(Error)> ErrorCallback) {}

// parseObjcopyOptions returns the config and sets the input arguments. If a
// help flag is set then parseObjcopyOptions will print the help messege and
// exit.
Expected<DriverConfig>
objcopy::parseObjcopyOptions(ArrayRef<const char *> RawArgsArr,
                             function_ref<Error(Error)> ErrorCallback) {}

// parseInstallNameToolOptions returns the config and sets the input arguments.
// If a help flag is set then parseInstallNameToolOptions will print the help
// messege and exit.
Expected<DriverConfig>
objcopy::parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr) {}

Expected<DriverConfig>
objcopy::parseBitcodeStripOptions(ArrayRef<const char *> ArgsArr,
                                  function_ref<Error(Error)> ErrorCallback) {}

// parseStripOptions returns the config and sets the input arguments. If a
// help flag is set then parseStripOptions will print the help messege and
// exit.
Expected<DriverConfig>
objcopy::parseStripOptions(ArrayRef<const char *> RawArgsArr,
                           function_ref<Error(Error)> ErrorCallback) {}