#include "COFFDump.h"
#include "llvm-objdump.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Win64EH.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacellvm;
usingnamespacellvm::objdump;
usingnamespacellvm::object;
usingnamespacellvm::Win64EH;
namespace {
template <typename T> struct EnumEntry { … };
class COFFDumper : public Dumper { … };
}
std::unique_ptr<Dumper>
objdump::createCOFFDumper(const object::COFFObjectFile &Obj) { … }
constexpr EnumEntry<uint16_t> PEHeaderMagic[] = …;
constexpr EnumEntry<COFF::WindowsSubsystem> PEWindowsSubsystem[] = …;
template <typename T, typename TEnum>
static void printOptionalEnumName(T Value,
ArrayRef<EnumEntry<TEnum>> EnumValues) { … }
template <class PEHeader>
void COFFDumper::printPEHeader(const PEHeader &Hdr) const { … }
static StringRef getUnwindCodeTypeName(uint8_t Code) { … }
static StringRef getUnwindRegisterName(uint8_t Reg) { … }
static unsigned getNumUsedSlots(const UnwindCode &UnwindCode) { … }
static void printUnwindCode(ArrayRef<UnwindCode> UCs) { … }
static void printAllUnwindCodes(ArrayRef<UnwindCode> UCs) { … }
static Error resolveSectionAndAddress(const COFFObjectFile *Obj,
const SymbolRef &Sym,
const coff_section *&ResolvedSection,
uint64_t &ResolvedAddr) { … }
static Error resolveSymbol(const std::vector<RelocationRef> &Rels,
uint64_t Offset, SymbolRef &Sym) { … }
static Error
getSectionContents(const COFFObjectFile *Obj,
const std::vector<RelocationRef> &Rels, uint64_t Offset,
ArrayRef<uint8_t> &Contents, uint64_t &Addr) { … }
static Error resolveSymbolName(const std::vector<RelocationRef> &Rels,
uint64_t Offset, StringRef &Name) { … }
static void printCOFFSymbolAddress(raw_ostream &Out,
const std::vector<RelocationRef> &Rels,
uint64_t Offset, uint32_t Disp) { … }
static void
printSEHTable(const COFFObjectFile *Obj, uint32_t TableVA, int Count) { … }
template <typename T>
static void printTLSDirectoryT(const coff_tls_directory<T> *TLSDir) { … }
static void printTLSDirectory(const COFFObjectFile *Obj) { … }
static void printLoadConfiguration(const COFFObjectFile *Obj) { … }
static void printImportTables(const COFFObjectFile *Obj) { … }
static void printExportTable(const COFFObjectFile *Obj) { … }
static bool getPDataSection(const COFFObjectFile *Obj,
std::vector<RelocationRef> &Rels,
const RuntimeFunction *&RFStart, int &NumRFs) { … }
Error objdump::getCOFFRelocationValueString(const COFFObjectFile *Obj,
const RelocationRef &Rel,
SmallVectorImpl<char> &Result) { … }
static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) { … }
static void printRuntimeFunction(const COFFObjectFile *Obj,
const RuntimeFunction &RF) { … }
static void printRuntimeFunctionRels(const COFFObjectFile *Obj,
const RuntimeFunction &RF,
uint64_t SectionOffset,
const std::vector<RelocationRef> &Rels) { … }
void objdump::printCOFFUnwindInfo(const COFFObjectFile *Obj) { … }
void COFFDumper::printPrivateHeaders() { … }
void objdump::printCOFFSymbolTable(const object::COFFImportFile &i) { … }
void objdump::printCOFFSymbolTable(const COFFObjectFile &coff) { … }