#include "llvm-readobj.h"
#include "ObjDumper.h"
#include "WindowsResourceDumper.h"
#include "llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h"
#include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/Wasm.h"
#include "llvm/Object/WindowsResource.h"
#include "llvm/Object/XCOFFObjectFile.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/WithColor.h"
usingnamespacellvm;
usingnamespacellvm::object;
namespace {
usingnamespacellvm::opt;
enum ID { … };
#define PREFIX …
#include "Opts.inc"
#undef PREFIX
static constexpr opt::OptTable::Info InfoTable[] = …;
class ReadobjOptTable : public opt::GenericOptTable { … };
enum OutputFormatTy { … };
enum SortSymbolKeyTy { … };
}
namespace opts {
static bool Addrsig;
static bool All;
static bool ArchSpecificInfo;
static bool BBAddrMap;
static bool PrettyPGOAnalysisMap;
bool ExpandRelocs;
static bool CGProfile;
static bool Decompress;
bool Demangle;
static bool DependentLibraries;
static bool DynRelocs;
static bool DynamicSymbols;
static bool ExtraSymInfo;
static bool FileHeaders;
static bool Headers;
static std::vector<std::string> HexDump;
static bool PrettyPrint;
static bool PrintStackMap;
static bool PrintStackSizes;
static bool Relocations;
bool SectionData;
static bool SectionDetails;
static bool SectionHeaders;
bool SectionRelocations;
bool SectionSymbols;
static std::vector<std::string> StringDump;
static bool StringTable;
static bool Symbols;
static bool UnwindInfo;
static cl::boolOrDefault SectionMapping;
static SmallVector<SortSymbolKeyTy> SortKeys;
static bool DynamicTable;
static bool ELFLinkerOptions;
static bool GnuHashTable;
static bool HashSymbols;
static bool HashTable;
static bool HashHistogram;
static bool Memtag;
static bool NeededLibraries;
static bool Notes;
static bool ProgramHeaders;
static bool SectionGroups;
static bool VersionInfo;
static bool MachODataInCode;
static bool MachODysymtab;
static bool MachOIndirectSymbols;
static bool MachOLinkerOptions;
static bool MachOSegment;
static bool MachOVersionMin;
static bool CodeView;
static bool CodeViewEnableGHash;
static bool CodeViewMergedTypes;
bool CodeViewSubsectionBytes;
static bool COFFBaseRelocs;
static bool COFFDebugDirectory;
static bool COFFDirectives;
static bool COFFExports;
static bool COFFImports;
static bool COFFLoadConfig;
static bool COFFResources;
static bool COFFTLSDirectory;
static bool XCOFFAuxiliaryHeader;
static bool XCOFFLoaderSectionHeader;
static bool XCOFFLoaderSectionSymbol;
static bool XCOFFLoaderSectionRelocation;
static bool XCOFFExceptionSection;
OutputStyleTy Output = …;
static std::vector<std::string> InputFilenames;
}
static StringRef ToolName;
namespace llvm {
[[noreturn]] static void error(Twine Msg) { … }
[[noreturn]] void reportError(Error Err, StringRef Input) { … }
void reportWarning(Error Err, StringRef Input) { … }
}
static void parseOptions(const opt::InputArgList &Args) { … }
namespace {
struct ReadObjTypeTableBuilder { … };
}
static ReadObjTypeTableBuilder CVTypes;
static Expected<std::unique_ptr<ObjDumper>>
createDumper(const ObjectFile &Obj, ScopedPrinter &Writer) { … }
static void dumpObject(ObjectFile &Obj, ScopedPrinter &Writer,
const Archive *A = nullptr) { … }
static void dumpArchive(const Archive *Arc, ScopedPrinter &Writer) { … }
static void dumpMachOUniversalBinary(const MachOUniversalBinary *UBinary,
ScopedPrinter &Writer) { … }
static void dumpCOFFObject(COFFObjectFile *Obj, ScopedPrinter &Writer) { … }
static void dumpWindowsResourceFile(WindowsResource *WinRes,
ScopedPrinter &Printer) { … }
static void dumpInput(StringRef File, ScopedPrinter &Writer) { … }
std::unique_ptr<ScopedPrinter> createWriter() { … }
int llvm_readobj_main(int argc, char **argv, const llvm::ToolContext &) { … }