llvm/llvm/tools/llvm-readobj/COFFDumper.cpp

//===-- COFFDumper.cpp - COFF-specific dumper -------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file implements the COFF-specific dumper for llvm-readobj.
///
//===----------------------------------------------------------------------===//

#include "ARMWinEHPrinter.h"
#include "ObjDumper.h"
#include "StackMapPrinter.h"
#include "Win64EHDumper.h"
#include "llvm-readobj.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
#include "llvm/DebugInfo/CodeView/Formatters.h"
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeHashing.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
#include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/WindowsResource.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/Win64EH.h"
#include "llvm/Support/raw_ostream.h"
#include <ctime>

usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::codeview;
usingnamespacellvm::support;
usingnamespacellvm::Win64EH;

namespace {

struct LoadConfigTables {};

class COFFDumper : public ObjDumper {};

class COFFObjectDumpDelegate : public SymbolDumpDelegate {};

} // end namespace

namespace llvm {

std::unique_ptr<ObjDumper> createCOFFDumper(const object::COFFObjectFile &Obj,
                                            ScopedPrinter &Writer) {}

} // namespace llvm

// Given a section and an offset into this section the function returns the
// symbol used for the relocation at the offset.
std::error_code COFFDumper::resolveSymbol(const coff_section *Section,
                                          uint64_t Offset, SymbolRef &Sym) {}

// Given a section and an offset into this section the function returns the name
// of the symbol used for the relocation at the offset.
std::error_code COFFDumper::resolveSymbolName(const coff_section *Section,
                                              uint64_t Offset,
                                              StringRef &Name) {}

// Helper for when you have a pointer to real data and you want to know about
// relocations against it.
std::error_code COFFDumper::resolveSymbolName(const coff_section *Section,
                                              StringRef SectionContents,
                                              const void *RelocPtr,
                                              StringRef &Name) {}

void COFFDumper::printRelocatedField(StringRef Label, const coff_section *Sec,
                                     uint32_t RelocOffset, uint32_t Offset,
                                     StringRef *RelocSym) {}

void COFFDumper::printBinaryBlockWithRelocs(StringRef Label,
                                            const SectionRef &Sec,
                                            StringRef SectionContents,
                                            StringRef Block) {}

const EnumEntry<COFF::MachineTypes> ImageFileMachineType[] =;

const EnumEntry<COFF::Characteristics> ImageFileCharacteristics[] =;

const EnumEntry<COFF::WindowsSubsystem> PEWindowsSubsystem[] =;

const EnumEntry<COFF::DLLCharacteristics> PEDLLCharacteristics[] =;

static const EnumEntry<COFF::ExtendedDLLCharacteristics>
    PEExtendedDLLCharacteristics[] =;

static const EnumEntry<COFF::SectionCharacteristics>
ImageSectionCharacteristics[] =;

const EnumEntry<COFF::SymbolBaseType> ImageSymType[] =;

const EnumEntry<COFF::SymbolComplexType> ImageSymDType[] =;

const EnumEntry<COFF::SymbolStorageClass> ImageSymClass[] =;

const EnumEntry<COFF::COMDATType> ImageCOMDATSelect[] =;

const EnumEntry<COFF::DebugType> ImageDebugType[] =;

static const EnumEntry<COFF::WeakExternalCharacteristics>
WeakExternalCharacteristics[] =;

const EnumEntry<uint32_t> SubSectionTypes[] =;

const EnumEntry<uint32_t> FrameDataFlags[] =;

const EnumEntry<uint8_t> FileChecksumKindNames[] =;

const EnumEntry<uint32_t> PELoadConfigGuardFlags[] =;

template <typename T>
static std::error_code getSymbolAuxData(const COFFObjectFile *Obj,
                                        COFFSymbolRef Symbol,
                                        uint8_t AuxSymbolIdx, const T *&Aux) {}

void COFFDumper::cacheRelocations() {}

void COFFDumper::printDataDirectory(uint32_t Index,
                                    const std::string &FieldName) {}

void COFFDumper::printFileHeaders() {}

void COFFDumper::printDOSHeader(const dos_header *DH) {}

template <class PEHeader>
void COFFDumper::printPEHeader(const PEHeader *Hdr) {}

void COFFDumper::printCOFFDebugDirectory() {}

void COFFDumper::printRVATable(uint64_t TableVA, uint64_t Count,
                               uint64_t EntrySize, PrintExtraCB PrintExtra) {}

void COFFDumper::printCOFFLoadConfig() {}

template <typename T>
void COFFDumper::printCOFFLoadConfig(const T *Conf, LoadConfigTables &Tables) {}

void COFFDumper::printBaseOfDataField(const pe32_header *Hdr) {}

void COFFDumper::printBaseOfDataField(const pe32plus_header *) {}

void COFFDumper::printCodeViewDebugInfo() {}

void COFFDumper::initializeFileAndStringTables(BinaryStreamReader &Reader) {}

void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
                                            const SectionRef &Section) {}

void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
                                                const SectionRef &Section,
                                                StringRef SectionContents) {}

void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) {}

void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) {}

StringRef COFFDumper::getFileNameForFileOffset(uint32_t FileOffset) {}

void COFFDumper::printFileNameForOffset(StringRef Label, uint32_t FileOffset) {}

void COFFDumper::mergeCodeViewTypes(MergingTypeTableBuilder &CVIDs,
                                    MergingTypeTableBuilder &CVTypes,
                                    GlobalTypeTableBuilder &GlobalCVIDs,
                                    GlobalTypeTableBuilder &GlobalCVTypes,
                                    bool GHash) {}

void COFFDumper::printCodeViewTypeSection(StringRef SectionName,
                                          const SectionRef &Section) {}

void COFFDumper::printSectionHeaders() {}

void COFFDumper::printRelocations() {}

void COFFDumper::printRelocation(const SectionRef &Section,
                                 const RelocationRef &Reloc, uint64_t Bias) {}

void COFFDumper::printSymbols(bool /*ExtraSymInfo*/) {}

void COFFDumper::printDynamicSymbols() {}

static Expected<StringRef>
getSectionName(const llvm::object::COFFObjectFile *Obj, int32_t SectionNumber,
               const coff_section *Section) {}

void COFFDumper::printSymbol(const SymbolRef &Sym) {}

void COFFDumper::printUnwindInfo() {}

void COFFDumper::printNeededLibraries() {}

void COFFDumper::printImportedSymbols(
    iterator_range<imported_symbol_iterator> Range) {}

void COFFDumper::printDelayImportedSymbols(
    const DelayImportDirectoryEntryRef &I,
    iterator_range<imported_symbol_iterator> Range) {}

void COFFDumper::printCOFFImports() {}

void COFFDumper::printCOFFExports() {}

void COFFDumper::printCOFFDirectives() {}

static std::string getBaseRelocTypeName(uint8_t Type) {}

void COFFDumper::printCOFFBaseReloc() {}

void COFFDumper::printCOFFResources() {}

uint32_t
COFFDumper::countTotalTableEntries(ResourceSectionRef RSF,
                                   const coff_resource_dir_table &Table,
                                   StringRef Level) {}

void COFFDumper::printResourceDirectoryTable(
    ResourceSectionRef RSF, const coff_resource_dir_table &Table,
    StringRef Level) {}

void COFFDumper::printStackMap() const {}

void COFFDumper::printAddrsig() {}

void COFFDumper::printCGProfile() {}

StringRef COFFDumper::getSymbolName(uint32_t Index) {}

void llvm::dumpCodeViewMergedTypes(ScopedPrinter &Writer,
                                   ArrayRef<ArrayRef<uint8_t>> IpiRecords,
                                   ArrayRef<ArrayRef<uint8_t>> TpiRecords) {}

void COFFDumper::printCOFFTLSDirectory() {}

template <typename IntTy>
void COFFDumper::printCOFFTLSDirectory(
    const coff_tls_directory<IntTy> *TlsTable) {}