2012-12-06 04:12:35 +08:00
|
|
|
//===-- COFFDump.cpp - COFF-specific dumper ---------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
2012-12-06 04:12:35 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
2018-05-01 23:54:18 +08:00
|
|
|
/// This file implements the COFF-specific dumper for llvm-objdump.
|
2012-12-06 04:12:35 +08:00
|
|
|
/// It outputs the Win64 EH data structures as plain text.
|
2014-01-25 01:20:08 +08:00
|
|
|
/// The encoding of the unwind codes is described in MSDN:
|
2012-12-06 04:12:35 +08:00
|
|
|
/// http://msdn.microsoft.com/en-us/library/ck9asaa9.aspx
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm-objdump.h"
|
2018-08-21 06:18:21 +08:00
|
|
|
#include "llvm/Demangle/Demangle.h"
|
2012-12-06 04:12:35 +08:00
|
|
|
#include "llvm/Object/COFF.h"
|
2016-08-19 00:39:19 +08:00
|
|
|
#include "llvm/Object/COFFImportFile.h"
|
2012-12-06 04:12:35 +08:00
|
|
|
#include "llvm/Object/ObjectFile.h"
|
|
|
|
#include "llvm/Support/Format.h"
|
2013-01-02 18:26:28 +08:00
|
|
|
#include "llvm/Support/Win64EH.h"
|
2018-11-12 06:12:04 +08:00
|
|
|
#include "llvm/Support/WithColor.h"
|
2012-12-06 04:12:35 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
using namespace llvm::object;
|
2012-12-06 04:12:35 +08:00
|
|
|
using namespace llvm::Win64EH;
|
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
namespace llvm {
|
2012-12-06 04:12:35 +08:00
|
|
|
// Returns the name of the unwind code.
|
|
|
|
static StringRef getUnwindCodeTypeName(uint8_t Code) {
|
|
|
|
switch(Code) {
|
|
|
|
default: llvm_unreachable("Invalid unwind code");
|
|
|
|
case UOP_PushNonVol: return "UOP_PushNonVol";
|
|
|
|
case UOP_AllocLarge: return "UOP_AllocLarge";
|
|
|
|
case UOP_AllocSmall: return "UOP_AllocSmall";
|
|
|
|
case UOP_SetFPReg: return "UOP_SetFPReg";
|
|
|
|
case UOP_SaveNonVol: return "UOP_SaveNonVol";
|
|
|
|
case UOP_SaveNonVolBig: return "UOP_SaveNonVolBig";
|
|
|
|
case UOP_SaveXMM128: return "UOP_SaveXMM128";
|
|
|
|
case UOP_SaveXMM128Big: return "UOP_SaveXMM128Big";
|
|
|
|
case UOP_PushMachFrame: return "UOP_PushMachFrame";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the name of a referenced register.
|
|
|
|
static StringRef getUnwindRegisterName(uint8_t Reg) {
|
|
|
|
switch(Reg) {
|
|
|
|
default: llvm_unreachable("Invalid register");
|
|
|
|
case 0: return "RAX";
|
|
|
|
case 1: return "RCX";
|
|
|
|
case 2: return "RDX";
|
|
|
|
case 3: return "RBX";
|
|
|
|
case 4: return "RSP";
|
|
|
|
case 5: return "RBP";
|
|
|
|
case 6: return "RSI";
|
|
|
|
case 7: return "RDI";
|
|
|
|
case 8: return "R8";
|
|
|
|
case 9: return "R9";
|
|
|
|
case 10: return "R10";
|
|
|
|
case 11: return "R11";
|
|
|
|
case 12: return "R12";
|
|
|
|
case 13: return "R13";
|
|
|
|
case 14: return "R14";
|
|
|
|
case 15: return "R15";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculates the number of array slots required for the unwind code.
|
|
|
|
static unsigned getNumUsedSlots(const UnwindCode &UnwindCode) {
|
|
|
|
switch (UnwindCode.getUnwindOp()) {
|
|
|
|
default: llvm_unreachable("Invalid unwind code");
|
|
|
|
case UOP_PushNonVol:
|
|
|
|
case UOP_AllocSmall:
|
|
|
|
case UOP_SetFPReg:
|
|
|
|
case UOP_PushMachFrame:
|
|
|
|
return 1;
|
|
|
|
case UOP_SaveNonVol:
|
|
|
|
case UOP_SaveXMM128:
|
|
|
|
return 2;
|
|
|
|
case UOP_SaveNonVolBig:
|
|
|
|
case UOP_SaveXMM128Big:
|
|
|
|
return 3;
|
|
|
|
case UOP_AllocLarge:
|
|
|
|
return (UnwindCode.getOpInfo() == 0) ? 2 : 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prints one unwind code. Because an unwind code can occupy up to 3 slots in
|
|
|
|
// the unwind codes array, this function requires that the correct number of
|
|
|
|
// slots is provided.
|
|
|
|
static void printUnwindCode(ArrayRef<UnwindCode> UCs) {
|
|
|
|
assert(UCs.size() >= getNumUsedSlots(UCs[0]));
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << format(" 0x%02x: ", unsigned(UCs[0].u.CodeOffset))
|
2012-12-06 04:12:35 +08:00
|
|
|
<< getUnwindCodeTypeName(UCs[0].getUnwindOp());
|
|
|
|
switch (UCs[0].getUnwindOp()) {
|
|
|
|
case UOP_PushNonVol:
|
|
|
|
outs() << " " << getUnwindRegisterName(UCs[0].getOpInfo());
|
|
|
|
break;
|
|
|
|
case UOP_AllocLarge:
|
|
|
|
if (UCs[0].getOpInfo() == 0) {
|
|
|
|
outs() << " " << UCs[1].FrameOffset;
|
|
|
|
} else {
|
|
|
|
outs() << " " << UCs[1].FrameOffset
|
|
|
|
+ (static_cast<uint32_t>(UCs[2].FrameOffset) << 16);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case UOP_AllocSmall:
|
|
|
|
outs() << " " << ((UCs[0].getOpInfo() + 1) * 8);
|
|
|
|
break;
|
|
|
|
case UOP_SetFPReg:
|
|
|
|
outs() << " ";
|
|
|
|
break;
|
|
|
|
case UOP_SaveNonVol:
|
|
|
|
outs() << " " << getUnwindRegisterName(UCs[0].getOpInfo())
|
|
|
|
<< format(" [0x%04x]", 8 * UCs[1].FrameOffset);
|
|
|
|
break;
|
|
|
|
case UOP_SaveNonVolBig:
|
|
|
|
outs() << " " << getUnwindRegisterName(UCs[0].getOpInfo())
|
|
|
|
<< format(" [0x%08x]", UCs[1].FrameOffset
|
|
|
|
+ (static_cast<uint32_t>(UCs[2].FrameOffset) << 16));
|
|
|
|
break;
|
|
|
|
case UOP_SaveXMM128:
|
|
|
|
outs() << " XMM" << static_cast<uint32_t>(UCs[0].getOpInfo())
|
|
|
|
<< format(" [0x%04x]", 16 * UCs[1].FrameOffset);
|
|
|
|
break;
|
|
|
|
case UOP_SaveXMM128Big:
|
|
|
|
outs() << " XMM" << UCs[0].getOpInfo()
|
|
|
|
<< format(" [0x%08x]", UCs[1].FrameOffset
|
|
|
|
+ (static_cast<uint32_t>(UCs[2].FrameOffset) << 16));
|
|
|
|
break;
|
|
|
|
case UOP_PushMachFrame:
|
|
|
|
outs() << " " << (UCs[0].getOpInfo() ? "w/o" : "w")
|
|
|
|
<< " error code";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
outs() << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
static void printAllUnwindCodes(ArrayRef<UnwindCode> UCs) {
|
|
|
|
for (const UnwindCode *I = UCs.begin(), *E = UCs.end(); I < E; ) {
|
|
|
|
unsigned UsedSlots = getNumUsedSlots(*I);
|
|
|
|
if (UsedSlots > UCs.size()) {
|
|
|
|
outs() << "Unwind data corrupted: Encountered unwind op "
|
|
|
|
<< getUnwindCodeTypeName((*I).getUnwindOp())
|
|
|
|
<< " which requires " << UsedSlots
|
|
|
|
<< " slots, but only " << UCs.size()
|
|
|
|
<< " remaining in buffer";
|
|
|
|
return ;
|
|
|
|
}
|
2015-09-21 13:32:41 +08:00
|
|
|
printUnwindCode(makeArrayRef(I, E));
|
2012-12-06 04:12:35 +08:00
|
|
|
I += UsedSlots;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Given a symbol sym this functions returns the address and section of it.
|
2019-04-09 13:41:24 +08:00
|
|
|
static Error resolveSectionAndAddress(const COFFObjectFile *Obj,
|
|
|
|
const SymbolRef &Sym,
|
|
|
|
const coff_section *&ResolvedSection,
|
|
|
|
uint64_t &ResolvedAddr) {
|
2016-06-25 02:24:42 +08:00
|
|
|
Expected<uint64_t> ResolvedAddrOrErr = Sym.getAddress();
|
|
|
|
if (!ResolvedAddrOrErr)
|
2019-04-09 13:41:24 +08:00
|
|
|
return ResolvedAddrOrErr.takeError();
|
2015-07-04 02:19:00 +08:00
|
|
|
ResolvedAddr = *ResolvedAddrOrErr;
|
2016-05-03 04:28:12 +08:00
|
|
|
Expected<section_iterator> Iter = Sym.getSection();
|
|
|
|
if (!Iter)
|
2019-04-09 13:41:24 +08:00
|
|
|
return Iter.takeError();
|
2015-08-08 07:27:14 +08:00
|
|
|
ResolvedSection = Obj->getCOFFSection(**Iter);
|
2019-04-09 13:41:24 +08:00
|
|
|
return Error::success();
|
2012-12-06 04:12:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Given a vector of relocations for a section and an offset into this section
|
|
|
|
// the function returns the symbol used for the relocation at the offset.
|
2019-04-09 13:41:24 +08:00
|
|
|
static Error resolveSymbol(const std::vector<RelocationRef> &Rels,
|
2014-06-13 11:07:50 +08:00
|
|
|
uint64_t Offset, SymbolRef &Sym) {
|
2016-10-01 07:22:42 +08:00
|
|
|
for (auto &R : Rels) {
|
|
|
|
uint64_t Ofs = R.getOffset();
|
2012-12-06 04:12:35 +08:00
|
|
|
if (Ofs == Offset) {
|
2016-10-01 07:22:42 +08:00
|
|
|
Sym = *R.getSymbol();
|
2019-04-09 13:41:24 +08:00
|
|
|
return Error::success();
|
2012-12-06 04:12:35 +08:00
|
|
|
}
|
|
|
|
}
|
2019-04-09 13:41:24 +08:00
|
|
|
return make_error<BinaryError>();
|
2012-12-06 04:12:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Given a vector of relocations for a section and an offset into this section
|
|
|
|
// the function resolves the symbol used for the relocation at the offset and
|
|
|
|
// returns the section content and the address inside the content pointed to
|
|
|
|
// by the symbol.
|
2019-04-09 13:41:24 +08:00
|
|
|
static Error
|
2014-06-13 11:07:50 +08:00
|
|
|
getSectionContents(const COFFObjectFile *Obj,
|
|
|
|
const std::vector<RelocationRef> &Rels, uint64_t Offset,
|
|
|
|
ArrayRef<uint8_t> &Contents, uint64_t &Addr) {
|
2012-12-06 04:12:35 +08:00
|
|
|
SymbolRef Sym;
|
2019-04-09 13:41:24 +08:00
|
|
|
if (Error E = resolveSymbol(Rels, Offset, Sym))
|
|
|
|
return E;
|
2012-12-06 04:12:35 +08:00
|
|
|
const coff_section *Section;
|
2019-04-09 13:41:24 +08:00
|
|
|
if (Error E = resolveSectionAndAddress(Obj, Sym, Section, Addr))
|
|
|
|
return E;
|
2014-06-13 11:07:50 +08:00
|
|
|
if (std::error_code EC = Obj->getSectionContents(Section, Contents))
|
2019-04-09 13:41:24 +08:00
|
|
|
return errorCodeToError(EC);
|
|
|
|
return Error::success();
|
2012-12-06 04:12:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Given a vector of relocations for a section and an offset into this section
|
|
|
|
// the function returns the name of the symbol used for the relocation at the
|
|
|
|
// offset.
|
2019-04-09 13:41:24 +08:00
|
|
|
static Error resolveSymbolName(const std::vector<RelocationRef> &Rels,
|
|
|
|
uint64_t Offset, StringRef &Name) {
|
2012-12-06 04:12:35 +08:00
|
|
|
SymbolRef Sym;
|
2019-04-09 13:41:24 +08:00
|
|
|
if (Error EC = resolveSymbol(Rels, Offset, Sym))
|
2014-01-17 04:57:55 +08:00
|
|
|
return EC;
|
2016-04-21 05:24:34 +08:00
|
|
|
Expected<StringRef> NameOrErr = Sym.getName();
|
|
|
|
if (!NameOrErr)
|
2019-04-09 13:41:24 +08:00
|
|
|
return NameOrErr.takeError();
|
2015-07-03 04:55:21 +08:00
|
|
|
Name = *NameOrErr;
|
2019-04-09 13:41:24 +08:00
|
|
|
return Error::success();
|
2012-12-06 04:12:35 +08:00
|
|
|
}
|
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
static void printCOFFSymbolAddress(raw_ostream &Out,
|
2012-12-06 04:12:35 +08:00
|
|
|
const std::vector<RelocationRef> &Rels,
|
|
|
|
uint64_t Offset, uint32_t Disp) {
|
|
|
|
StringRef Sym;
|
2014-02-28 13:21:29 +08:00
|
|
|
if (!resolveSymbolName(Rels, Offset, Sym)) {
|
|
|
|
Out << Sym;
|
|
|
|
if (Disp > 0)
|
|
|
|
Out << format(" + 0x%04x", Disp);
|
|
|
|
} else {
|
|
|
|
Out << format("0x%04x", Disp);
|
|
|
|
}
|
2012-12-06 04:12:35 +08:00
|
|
|
}
|
|
|
|
|
2014-02-20 14:51:07 +08:00
|
|
|
static void
|
|
|
|
printSEHTable(const COFFObjectFile *Obj, uint32_t TableVA, int Count) {
|
|
|
|
if (Count == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const pe32_header *PE32Header;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(Obj->getPE32Header(PE32Header));
|
2014-02-20 14:51:07 +08:00
|
|
|
uint32_t ImageBase = PE32Header->ImageBase;
|
|
|
|
uintptr_t IntPtr = 0;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(Obj->getVaPtr(TableVA, IntPtr));
|
2014-02-20 14:51:07 +08:00
|
|
|
const support::ulittle32_t *P = (const support::ulittle32_t *)IntPtr;
|
|
|
|
outs() << "SEH Table:";
|
|
|
|
for (int I = 0; I < Count; ++I)
|
|
|
|
outs() << format(" 0x%x", P[I] + ImageBase);
|
|
|
|
outs() << "\n\n";
|
|
|
|
}
|
|
|
|
|
2016-03-15 14:14:01 +08:00
|
|
|
template <typename T>
|
|
|
|
static void printTLSDirectoryT(const coff_tls_directory<T> *TLSDir) {
|
|
|
|
size_t FormatWidth = sizeof(T) * 2;
|
|
|
|
outs() << "TLS directory:"
|
|
|
|
<< "\n StartAddressOfRawData: "
|
|
|
|
<< format_hex(TLSDir->StartAddressOfRawData, FormatWidth)
|
|
|
|
<< "\n EndAddressOfRawData: "
|
|
|
|
<< format_hex(TLSDir->EndAddressOfRawData, FormatWidth)
|
|
|
|
<< "\n AddressOfIndex: "
|
|
|
|
<< format_hex(TLSDir->AddressOfIndex, FormatWidth)
|
|
|
|
<< "\n AddressOfCallBacks: "
|
|
|
|
<< format_hex(TLSDir->AddressOfCallBacks, FormatWidth)
|
|
|
|
<< "\n SizeOfZeroFill: "
|
|
|
|
<< TLSDir->SizeOfZeroFill
|
|
|
|
<< "\n Characteristics: "
|
|
|
|
<< TLSDir->Characteristics
|
|
|
|
<< "\n Alignment: "
|
|
|
|
<< TLSDir->getAlignment()
|
|
|
|
<< "\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
static void printTLSDirectory(const COFFObjectFile *Obj) {
|
|
|
|
const pe32_header *PE32Header;
|
|
|
|
error(Obj->getPE32Header(PE32Header));
|
|
|
|
|
|
|
|
const pe32plus_header *PE32PlusHeader;
|
|
|
|
error(Obj->getPE32PlusHeader(PE32PlusHeader));
|
|
|
|
|
|
|
|
// Skip if it's not executable.
|
|
|
|
if (!PE32Header && !PE32PlusHeader)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const data_directory *DataDir;
|
|
|
|
error(Obj->getDataDirectory(COFF::TLS_TABLE, DataDir));
|
|
|
|
uintptr_t IntPtr = 0;
|
|
|
|
if (DataDir->RelativeVirtualAddress == 0)
|
|
|
|
return;
|
|
|
|
error(Obj->getRvaPtr(DataDir->RelativeVirtualAddress, IntPtr));
|
|
|
|
|
|
|
|
if (PE32Header) {
|
|
|
|
auto *TLSDir = reinterpret_cast<const coff_tls_directory32 *>(IntPtr);
|
|
|
|
printTLSDirectoryT(TLSDir);
|
|
|
|
} else {
|
|
|
|
auto *TLSDir = reinterpret_cast<const coff_tls_directory64 *>(IntPtr);
|
|
|
|
printTLSDirectoryT(TLSDir);
|
|
|
|
}
|
|
|
|
|
|
|
|
outs() << "\n";
|
|
|
|
}
|
|
|
|
|
2014-02-19 11:53:11 +08:00
|
|
|
static void printLoadConfiguration(const COFFObjectFile *Obj) {
|
2014-02-22 04:27:15 +08:00
|
|
|
// Skip if it's not executable.
|
|
|
|
const pe32_header *PE32Header;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(Obj->getPE32Header(PE32Header));
|
2014-02-22 04:27:15 +08:00
|
|
|
if (!PE32Header)
|
|
|
|
return;
|
|
|
|
|
2014-02-19 11:53:11 +08:00
|
|
|
// Currently only x86 is supported
|
2014-09-10 20:51:52 +08:00
|
|
|
if (Obj->getMachine() != COFF::IMAGE_FILE_MACHINE_I386)
|
2014-02-19 11:53:11 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
const data_directory *DataDir;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(Obj->getDataDirectory(COFF::LOAD_CONFIG_TABLE, DataDir));
|
2014-02-19 11:53:11 +08:00
|
|
|
uintptr_t IntPtr = 0;
|
|
|
|
if (DataDir->RelativeVirtualAddress == 0)
|
|
|
|
return;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(Obj->getRvaPtr(DataDir->RelativeVirtualAddress, IntPtr));
|
2014-02-20 14:51:07 +08:00
|
|
|
|
2014-03-04 12:15:59 +08:00
|
|
|
auto *LoadConf = reinterpret_cast<const coff_load_configuration32 *>(IntPtr);
|
2014-02-19 11:53:11 +08:00
|
|
|
outs() << "Load configuration:"
|
|
|
|
<< "\n Timestamp: " << LoadConf->TimeDateStamp
|
|
|
|
<< "\n Major Version: " << LoadConf->MajorVersion
|
|
|
|
<< "\n Minor Version: " << LoadConf->MinorVersion
|
|
|
|
<< "\n GlobalFlags Clear: " << LoadConf->GlobalFlagsClear
|
|
|
|
<< "\n GlobalFlags Set: " << LoadConf->GlobalFlagsSet
|
|
|
|
<< "\n Critical Section Default Timeout: " << LoadConf->CriticalSectionDefaultTimeout
|
|
|
|
<< "\n Decommit Free Block Threshold: " << LoadConf->DeCommitFreeBlockThreshold
|
|
|
|
<< "\n Decommit Total Free Threshold: " << LoadConf->DeCommitTotalFreeThreshold
|
|
|
|
<< "\n Lock Prefix Table: " << LoadConf->LockPrefixTable
|
|
|
|
<< "\n Maximum Allocation Size: " << LoadConf->MaximumAllocationSize
|
|
|
|
<< "\n Virtual Memory Threshold: " << LoadConf->VirtualMemoryThreshold
|
|
|
|
<< "\n Process Affinity Mask: " << LoadConf->ProcessAffinityMask
|
|
|
|
<< "\n Process Heap Flags: " << LoadConf->ProcessHeapFlags
|
|
|
|
<< "\n CSD Version: " << LoadConf->CSDVersion
|
|
|
|
<< "\n Security Cookie: " << LoadConf->SecurityCookie
|
|
|
|
<< "\n SEH Table: " << LoadConf->SEHandlerTable
|
|
|
|
<< "\n SEH Count: " << LoadConf->SEHandlerCount
|
|
|
|
<< "\n\n";
|
2014-02-20 14:51:07 +08:00
|
|
|
printSEHTable(Obj, LoadConf->SEHandlerTable, LoadConf->SEHandlerCount);
|
|
|
|
outs() << "\n";
|
2014-02-19 11:53:11 +08:00
|
|
|
}
|
|
|
|
|
2013-09-28 05:04:00 +08:00
|
|
|
// Prints import tables. The import table is a table containing the list of
|
|
|
|
// DLL name and symbol names which will be linked by the loader.
|
|
|
|
static void printImportTables(const COFFObjectFile *Obj) {
|
2014-01-17 04:57:55 +08:00
|
|
|
import_directory_iterator I = Obj->import_directory_begin();
|
|
|
|
import_directory_iterator E = Obj->import_directory_end();
|
|
|
|
if (I == E)
|
2014-01-16 07:46:18 +08:00
|
|
|
return;
|
2013-09-28 05:04:00 +08:00
|
|
|
outs() << "The Import Tables:\n";
|
2016-06-26 12:36:32 +08:00
|
|
|
for (const ImportDirectoryEntryRef &DirRef : Obj->import_directories()) {
|
2016-08-01 03:25:21 +08:00
|
|
|
const coff_import_directory_table_entry *Dir;
|
2013-09-28 05:04:00 +08:00
|
|
|
StringRef Name;
|
2016-06-26 12:36:32 +08:00
|
|
|
if (DirRef.getImportTableEntry(Dir)) return;
|
|
|
|
if (DirRef.getName(Name)) return;
|
2013-09-28 05:04:00 +08:00
|
|
|
|
|
|
|
outs() << format(" lookup %08x time %08x fwd %08x name %08x addr %08x\n\n",
|
|
|
|
static_cast<uint32_t>(Dir->ImportLookupTableRVA),
|
|
|
|
static_cast<uint32_t>(Dir->TimeDateStamp),
|
|
|
|
static_cast<uint32_t>(Dir->ForwarderChain),
|
|
|
|
static_cast<uint32_t>(Dir->NameRVA),
|
|
|
|
static_cast<uint32_t>(Dir->ImportAddressTableRVA));
|
|
|
|
outs() << " DLL Name: " << Name << "\n";
|
|
|
|
outs() << " Hint/Ord Name\n";
|
2016-06-26 12:36:32 +08:00
|
|
|
for (const ImportedSymbolRef &Entry : DirRef.imported_symbols()) {
|
|
|
|
bool IsOrdinal;
|
|
|
|
if (Entry.isOrdinal(IsOrdinal))
|
|
|
|
return;
|
|
|
|
if (IsOrdinal) {
|
|
|
|
uint16_t Ordinal;
|
|
|
|
if (Entry.getOrdinal(Ordinal))
|
|
|
|
return;
|
|
|
|
outs() << format(" % 6d\n", Ordinal);
|
2013-09-28 05:04:00 +08:00
|
|
|
continue;
|
|
|
|
}
|
2016-06-26 12:36:32 +08:00
|
|
|
uint32_t HintNameRVA;
|
|
|
|
if (Entry.getHintNameRVA(HintNameRVA))
|
|
|
|
return;
|
2013-09-28 05:04:00 +08:00
|
|
|
uint16_t Hint;
|
|
|
|
StringRef Name;
|
2016-06-26 12:36:32 +08:00
|
|
|
if (Obj->getHintName(HintNameRVA, Hint, Name))
|
2013-09-28 05:04:00 +08:00
|
|
|
return;
|
|
|
|
outs() << format(" % 6d ", Hint) << Name << "\n";
|
|
|
|
}
|
|
|
|
outs() << "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-16 15:05:49 +08:00
|
|
|
// Prints export tables. The export table is a table containing the list of
|
|
|
|
// exported symbol from the DLL.
|
|
|
|
static void printExportTable(const COFFObjectFile *Obj) {
|
|
|
|
outs() << "Export Table:\n";
|
|
|
|
export_directory_iterator I = Obj->export_directory_begin();
|
|
|
|
export_directory_iterator E = Obj->export_directory_end();
|
|
|
|
if (I == E)
|
|
|
|
return;
|
2014-01-17 04:50:34 +08:00
|
|
|
StringRef DllName;
|
2014-01-18 06:02:24 +08:00
|
|
|
uint32_t OrdinalBase;
|
2014-01-17 04:50:34 +08:00
|
|
|
if (I->getDllName(DllName))
|
|
|
|
return;
|
2014-01-18 06:02:24 +08:00
|
|
|
if (I->getOrdinalBase(OrdinalBase))
|
|
|
|
return;
|
2014-01-17 04:50:34 +08:00
|
|
|
outs() << " DLL name: " << DllName << "\n";
|
2014-01-18 06:02:24 +08:00
|
|
|
outs() << " Ordinal base: " << OrdinalBase << "\n";
|
2014-01-16 15:05:49 +08:00
|
|
|
outs() << " Ordinal RVA Name\n";
|
2014-01-30 10:49:50 +08:00
|
|
|
for (; I != E; I = ++I) {
|
2014-01-16 15:05:49 +08:00
|
|
|
uint32_t Ordinal;
|
|
|
|
if (I->getOrdinal(Ordinal))
|
|
|
|
return;
|
|
|
|
uint32_t RVA;
|
|
|
|
if (I->getExportRVA(RVA))
|
|
|
|
return;
|
2016-01-13 07:28:42 +08:00
|
|
|
bool IsForwarder;
|
|
|
|
if (I->isForwarder(IsForwarder))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (IsForwarder) {
|
|
|
|
// Export table entries can be used to re-export symbols that
|
|
|
|
// this COFF file is imported from some DLLs. This is rare.
|
|
|
|
// In most cases IsForwarder is false.
|
|
|
|
outs() << format(" % 4d ", Ordinal);
|
|
|
|
} else {
|
|
|
|
outs() << format(" % 4d %# 8x", Ordinal, RVA);
|
|
|
|
}
|
2014-01-16 15:05:49 +08:00
|
|
|
|
|
|
|
StringRef Name;
|
2014-01-17 04:50:34 +08:00
|
|
|
if (I->getSymbolName(Name))
|
2014-01-16 15:05:49 +08:00
|
|
|
continue;
|
|
|
|
if (!Name.empty())
|
|
|
|
outs() << " " << Name;
|
2016-01-13 07:28:42 +08:00
|
|
|
if (IsForwarder) {
|
|
|
|
StringRef S;
|
|
|
|
if (I->getForwardTo(S))
|
|
|
|
return;
|
|
|
|
outs() << " (forwarded to " << S << ")";
|
|
|
|
}
|
2014-01-16 15:05:49 +08:00
|
|
|
outs() << "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-04 08:31:48 +08:00
|
|
|
// Given the COFF object file, this function returns the relocations for .pdata
|
|
|
|
// and the pointer to "runtime function" structs.
|
|
|
|
static bool getPDataSection(const COFFObjectFile *Obj,
|
|
|
|
std::vector<RelocationRef> &Rels,
|
|
|
|
const RuntimeFunction *&RFStart, int &NumRFs) {
|
2014-03-18 14:53:02 +08:00
|
|
|
for (const SectionRef &Section : Obj->sections()) {
|
2012-12-06 04:12:35 +08:00
|
|
|
StringRef Name;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(Section.getName(Name));
|
2014-03-04 08:31:48 +08:00
|
|
|
if (Name != ".pdata")
|
|
|
|
continue;
|
2012-12-06 04:12:35 +08:00
|
|
|
|
2014-03-18 14:53:02 +08:00
|
|
|
const coff_section *Pdata = Obj->getCOFFSection(Section);
|
|
|
|
for (const RelocationRef &Reloc : Section.relocations())
|
2014-03-14 22:22:49 +08:00
|
|
|
Rels.push_back(Reloc);
|
2012-12-06 04:12:35 +08:00
|
|
|
|
|
|
|
// Sort relocations by address.
|
2019-01-15 17:19:18 +08:00
|
|
|
llvm::sort(Rels, isRelocAddressLess);
|
2012-12-06 04:12:35 +08:00
|
|
|
|
|
|
|
ArrayRef<uint8_t> Contents;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(Obj->getSectionContents(Pdata, Contents));
|
2014-03-04 08:31:48 +08:00
|
|
|
if (Contents.empty())
|
|
|
|
continue;
|
2012-12-06 04:12:35 +08:00
|
|
|
|
2014-03-04 08:31:48 +08:00
|
|
|
RFStart = reinterpret_cast<const RuntimeFunction *>(Contents.data());
|
|
|
|
NumRFs = Contents.size() / sizeof(RuntimeFunction);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2012-12-06 04:12:35 +08:00
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
Error getCOFFRelocationValueString(const COFFObjectFile *Obj,
|
2019-04-09 00:24:08 +08:00
|
|
|
const RelocationRef &Rel,
|
|
|
|
SmallVectorImpl<char> &Result) {
|
2019-01-18 19:33:26 +08:00
|
|
|
symbol_iterator SymI = Rel.getSymbol();
|
|
|
|
Expected<StringRef> SymNameOrErr = SymI->getName();
|
|
|
|
if (!SymNameOrErr)
|
2019-04-09 00:24:08 +08:00
|
|
|
return SymNameOrErr.takeError();
|
2019-01-18 19:33:26 +08:00
|
|
|
StringRef SymName = *SymNameOrErr;
|
|
|
|
Result.append(SymName.begin(), SymName.end());
|
2019-04-09 00:24:08 +08:00
|
|
|
return Error::success();
|
2019-01-18 19:33:26 +08:00
|
|
|
}
|
|
|
|
|
2014-03-04 11:08:45 +08:00
|
|
|
static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) {
|
|
|
|
// The casts to int are required in order to output the value as number.
|
|
|
|
// Without the casts the value would be interpreted as char data (which
|
|
|
|
// results in garbage output).
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << " Version: " << static_cast<int>(UI->getVersion()) << "\n";
|
|
|
|
outs() << " Flags: " << static_cast<int>(UI->getFlags());
|
2014-03-04 11:08:45 +08:00
|
|
|
if (UI->getFlags()) {
|
|
|
|
if (UI->getFlags() & UNW_ExceptionHandler)
|
|
|
|
outs() << " UNW_ExceptionHandler";
|
|
|
|
if (UI->getFlags() & UNW_TerminateHandler)
|
|
|
|
outs() << " UNW_TerminateHandler";
|
|
|
|
if (UI->getFlags() & UNW_ChainInfo)
|
|
|
|
outs() << " UNW_ChainInfo";
|
|
|
|
}
|
|
|
|
outs() << "\n";
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << " Size of prolog: " << static_cast<int>(UI->PrologSize) << "\n";
|
|
|
|
outs() << " Number of Codes: " << static_cast<int>(UI->NumCodes) << "\n";
|
2014-03-04 11:08:45 +08:00
|
|
|
// Maybe this should move to output of UOP_SetFPReg?
|
|
|
|
if (UI->getFrameRegister()) {
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << " Frame register: "
|
2014-03-04 11:08:45 +08:00
|
|
|
<< getUnwindRegisterName(UI->getFrameRegister()) << "\n";
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << " Frame offset: " << 16 * UI->getFrameOffset() << "\n";
|
2014-03-04 11:08:45 +08:00
|
|
|
} else {
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << " No frame pointer used\n";
|
2014-03-04 11:08:45 +08:00
|
|
|
}
|
|
|
|
if (UI->getFlags() & (UNW_ExceptionHandler | UNW_TerminateHandler)) {
|
|
|
|
// FIXME: Output exception handler data
|
|
|
|
} else if (UI->getFlags() & UNW_ChainInfo) {
|
|
|
|
// FIXME: Output chained unwind info
|
|
|
|
}
|
|
|
|
|
|
|
|
if (UI->NumCodes)
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << " Unwind Codes:\n";
|
2014-03-04 11:08:45 +08:00
|
|
|
|
2015-09-21 13:32:41 +08:00
|
|
|
printAllUnwindCodes(makeArrayRef(&UI->UnwindCodes[0], UI->NumCodes));
|
2014-03-04 11:08:45 +08:00
|
|
|
|
2014-03-05 03:23:56 +08:00
|
|
|
outs() << "\n";
|
2014-03-04 11:08:45 +08:00
|
|
|
outs().flush();
|
|
|
|
}
|
|
|
|
|
2014-03-04 12:22:41 +08:00
|
|
|
/// Prints out the given RuntimeFunction struct for x64, assuming that Obj is
|
2014-03-04 12:00:55 +08:00
|
|
|
/// pointing to an executable file.
|
2014-03-04 08:31:48 +08:00
|
|
|
static void printRuntimeFunction(const COFFObjectFile *Obj,
|
2014-03-04 12:00:55 +08:00
|
|
|
const RuntimeFunction &RF) {
|
|
|
|
if (!RF.StartAddress)
|
|
|
|
return;
|
|
|
|
outs() << "Function Table:\n"
|
2014-03-06 07:03:37 +08:00
|
|
|
<< format(" Start Address: 0x%04x\n",
|
|
|
|
static_cast<uint32_t>(RF.StartAddress))
|
|
|
|
<< format(" End Address: 0x%04x\n",
|
|
|
|
static_cast<uint32_t>(RF.EndAddress))
|
|
|
|
<< format(" Unwind Info Address: 0x%04x\n",
|
|
|
|
static_cast<uint32_t>(RF.UnwindInfoOffset));
|
2014-03-04 12:00:55 +08:00
|
|
|
uintptr_t addr;
|
|
|
|
if (Obj->getRvaPtr(RF.UnwindInfoOffset, addr))
|
|
|
|
return;
|
|
|
|
printWin64EHUnwindInfo(reinterpret_cast<const Win64EH::UnwindInfo *>(addr));
|
|
|
|
}
|
|
|
|
|
2014-03-04 12:22:41 +08:00
|
|
|
/// Prints out the given RuntimeFunction struct for x64, assuming that Obj is
|
|
|
|
/// pointing to an object file. Unlike executable, fields in RuntimeFunction
|
2014-03-04 12:00:55 +08:00
|
|
|
/// struct are filled with zeros, but instead there are relocations pointing to
|
|
|
|
/// them so that the linker will fill targets' RVAs to the fields at link
|
|
|
|
/// time. This function interprets the relocations to find the data to be used
|
|
|
|
/// in the resulting executable.
|
|
|
|
static void printRuntimeFunctionRels(const COFFObjectFile *Obj,
|
|
|
|
const RuntimeFunction &RF,
|
|
|
|
uint64_t SectionOffset,
|
|
|
|
const std::vector<RelocationRef> &Rels) {
|
2014-03-04 08:31:48 +08:00
|
|
|
outs() << "Function Table:\n";
|
|
|
|
outs() << " Start Address: ";
|
|
|
|
printCOFFSymbolAddress(outs(), Rels,
|
|
|
|
SectionOffset +
|
|
|
|
/*offsetof(RuntimeFunction, StartAddress)*/ 0,
|
|
|
|
RF.StartAddress);
|
|
|
|
outs() << "\n";
|
2012-12-06 04:12:35 +08:00
|
|
|
|
2014-03-04 08:31:48 +08:00
|
|
|
outs() << " End Address: ";
|
|
|
|
printCOFFSymbolAddress(outs(), Rels,
|
|
|
|
SectionOffset +
|
|
|
|
/*offsetof(RuntimeFunction, EndAddress)*/ 4,
|
|
|
|
RF.EndAddress);
|
|
|
|
outs() << "\n";
|
2012-12-06 04:12:35 +08:00
|
|
|
|
2014-03-04 08:31:48 +08:00
|
|
|
outs() << " Unwind Info Address: ";
|
|
|
|
printCOFFSymbolAddress(outs(), Rels,
|
|
|
|
SectionOffset +
|
|
|
|
/*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
|
|
|
|
RF.UnwindInfoOffset);
|
|
|
|
outs() << "\n";
|
|
|
|
|
|
|
|
ArrayRef<uint8_t> XContents;
|
|
|
|
uint64_t UnwindInfoOffset = 0;
|
2015-08-05 15:18:31 +08:00
|
|
|
error(getSectionContents(
|
2014-03-04 08:31:48 +08:00
|
|
|
Obj, Rels, SectionOffset +
|
|
|
|
/*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
|
2015-08-05 15:18:31 +08:00
|
|
|
XContents, UnwindInfoOffset));
|
2014-03-04 08:31:48 +08:00
|
|
|
if (XContents.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
UnwindInfoOffset += RF.UnwindInfoOffset;
|
|
|
|
if (UnwindInfoOffset > XContents.size())
|
|
|
|
return;
|
|
|
|
|
2014-03-04 12:15:59 +08:00
|
|
|
auto *UI = reinterpret_cast<const Win64EH::UnwindInfo *>(XContents.data() +
|
|
|
|
UnwindInfoOffset);
|
2014-03-04 11:08:45 +08:00
|
|
|
printWin64EHUnwindInfo(UI);
|
2014-03-04 08:31:48 +08:00
|
|
|
}
|
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
void printCOFFUnwindInfo(const COFFObjectFile *Obj) {
|
2014-09-10 20:51:52 +08:00
|
|
|
if (Obj->getMachine() != COFF::IMAGE_FILE_MACHINE_AMD64) {
|
2018-11-12 06:12:04 +08:00
|
|
|
WithColor::error(errs(), "llvm-objdump")
|
|
|
|
<< "unsupported image machine type "
|
|
|
|
"(currently only AMD64 is supported).\n";
|
2014-03-04 08:31:48 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<RelocationRef> Rels;
|
|
|
|
const RuntimeFunction *RFStart;
|
|
|
|
int NumRFs;
|
|
|
|
if (!getPDataSection(Obj, Rels, RFStart, NumRFs))
|
|
|
|
return;
|
|
|
|
ArrayRef<RuntimeFunction> RFs(RFStart, NumRFs);
|
|
|
|
|
2014-03-04 12:00:55 +08:00
|
|
|
bool IsExecutable = Rels.empty();
|
|
|
|
if (IsExecutable) {
|
|
|
|
for (const RuntimeFunction &RF : RFs)
|
|
|
|
printRuntimeFunction(Obj, RF);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-04 08:31:48 +08:00
|
|
|
for (const RuntimeFunction &RF : RFs) {
|
|
|
|
uint64_t SectionOffset =
|
|
|
|
std::distance(RFs.begin(), &RF) * sizeof(RuntimeFunction);
|
2014-03-04 12:00:55 +08:00
|
|
|
printRuntimeFunctionRels(Obj, RF, SectionOffset, Rels);
|
2012-12-06 04:12:35 +08:00
|
|
|
}
|
|
|
|
}
|
2013-09-28 05:04:00 +08:00
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
void printCOFFFileHeader(const object::ObjectFile *Obj) {
|
2014-01-16 15:05:49 +08:00
|
|
|
const COFFObjectFile *file = dyn_cast<const COFFObjectFile>(Obj);
|
2016-03-15 14:14:01 +08:00
|
|
|
printTLSDirectory(file);
|
2014-02-19 11:53:11 +08:00
|
|
|
printLoadConfiguration(file);
|
2014-01-16 15:05:49 +08:00
|
|
|
printImportTables(file);
|
|
|
|
printExportTable(file);
|
2013-09-28 05:04:00 +08:00
|
|
|
}
|
2015-12-20 17:54:34 +08:00
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
void printCOFFSymbolTable(const object::COFFImportFile *i) {
|
2016-08-19 00:39:19 +08:00
|
|
|
unsigned Index = 0;
|
|
|
|
bool IsCode = i->getCOFFImportHeader()->getType() == COFF::IMPORT_CODE;
|
|
|
|
|
|
|
|
for (const object::BasicSymbolRef &Sym : i->symbols()) {
|
|
|
|
std::string Name;
|
|
|
|
raw_string_ostream NS(Name);
|
|
|
|
|
|
|
|
Sym.printName(NS);
|
|
|
|
NS.flush();
|
|
|
|
|
|
|
|
outs() << "[" << format("%2d", Index) << "]"
|
|
|
|
<< "(sec " << format("%2d", 0) << ")"
|
|
|
|
<< "(fl 0x00)" // Flag bits, which COFF doesn't have.
|
|
|
|
<< "(ty " << format("%3x", (IsCode && Index) ? 32 : 0) << ")"
|
|
|
|
<< "(scl " << format("%3x", 0) << ") "
|
|
|
|
<< "(nx " << 0 << ") "
|
|
|
|
<< "0x" << format("%08x", 0) << " " << Name << '\n';
|
|
|
|
|
|
|
|
++Index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-15 23:31:42 +08:00
|
|
|
void printCOFFSymbolTable(const COFFObjectFile *coff) {
|
2015-12-20 17:54:34 +08:00
|
|
|
for (unsigned SI = 0, SE = coff->getNumberOfSymbols(); SI != SE; ++SI) {
|
2017-10-12 01:23:15 +08:00
|
|
|
Expected<COFFSymbolRef> Symbol = coff->getSymbol(SI);
|
2015-12-20 17:54:34 +08:00
|
|
|
StringRef Name;
|
2019-04-09 13:41:24 +08:00
|
|
|
error(Symbol.takeError());
|
2015-12-20 17:54:34 +08:00
|
|
|
error(coff->getSymbolName(*Symbol, Name));
|
|
|
|
|
|
|
|
outs() << "[" << format("%2d", SI) << "]"
|
|
|
|
<< "(sec " << format("%2d", int(Symbol->getSectionNumber())) << ")"
|
|
|
|
<< "(fl 0x00)" // Flag bits, which COFF doesn't have.
|
|
|
|
<< "(ty " << format("%3x", unsigned(Symbol->getType())) << ")"
|
2018-08-21 06:18:21 +08:00
|
|
|
<< "(scl " << format("%3x", unsigned(Symbol->getStorageClass()))
|
|
|
|
<< ") "
|
2015-12-20 17:54:34 +08:00
|
|
|
<< "(nx " << unsigned(Symbol->getNumberOfAuxSymbols()) << ") "
|
|
|
|
<< "0x" << format("%08x", unsigned(Symbol->getValue())) << " "
|
2018-08-21 06:18:21 +08:00
|
|
|
<< Name;
|
|
|
|
if (Demangle && Name.startswith("?")) {
|
|
|
|
char *DemangledSymbol = nullptr;
|
|
|
|
size_t Size = 0;
|
|
|
|
int Status = -1;
|
|
|
|
DemangledSymbol =
|
|
|
|
microsoftDemangle(Name.data(), DemangledSymbol, &Size, &Status);
|
|
|
|
|
|
|
|
if (Status == 0 && DemangledSymbol) {
|
|
|
|
outs() << " (" << StringRef(DemangledSymbol) << ")";
|
|
|
|
std::free(DemangledSymbol);
|
2018-08-22 05:23:29 +08:00
|
|
|
} else {
|
|
|
|
outs() << " (invalid mangled name)";
|
2018-08-21 06:18:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
outs() << "\n";
|
2015-12-20 17:54:34 +08:00
|
|
|
|
|
|
|
for (unsigned AI = 0, AE = Symbol->getNumberOfAuxSymbols(); AI < AE; ++AI, ++SI) {
|
|
|
|
if (Symbol->isSectionDefinition()) {
|
|
|
|
const coff_aux_section_definition *asd;
|
|
|
|
error(coff->getAuxSymbol<coff_aux_section_definition>(SI + 1, asd));
|
|
|
|
|
|
|
|
int32_t AuxNumber = asd->getNumber(Symbol->isBigObj());
|
|
|
|
|
|
|
|
outs() << "AUX "
|
|
|
|
<< format("scnlen 0x%x nreloc %d nlnno %d checksum 0x%x "
|
|
|
|
, unsigned(asd->Length)
|
|
|
|
, unsigned(asd->NumberOfRelocations)
|
|
|
|
, unsigned(asd->NumberOfLinenumbers)
|
|
|
|
, unsigned(asd->CheckSum))
|
|
|
|
<< format("assoc %d comdat %d\n"
|
|
|
|
, unsigned(AuxNumber)
|
|
|
|
, unsigned(asd->Selection));
|
|
|
|
} else if (Symbol->isFileRecord()) {
|
|
|
|
const char *FileName;
|
|
|
|
error(coff->getAuxSymbol<char>(SI + 1, FileName));
|
|
|
|
|
|
|
|
StringRef Name(FileName, Symbol->getNumberOfAuxSymbols() *
|
|
|
|
coff->getSymbolTableEntrySize());
|
|
|
|
outs() << "AUX " << Name.rtrim(StringRef("\0", 1)) << '\n';
|
|
|
|
|
|
|
|
SI = SI + Symbol->getNumberOfAuxSymbols();
|
|
|
|
break;
|
2016-05-26 09:45:12 +08:00
|
|
|
} else if (Symbol->isWeakExternal()) {
|
|
|
|
const coff_aux_weak_external *awe;
|
|
|
|
error(coff->getAuxSymbol<coff_aux_weak_external>(SI + 1, awe));
|
|
|
|
|
|
|
|
outs() << "AUX " << format("indx %d srch %d\n",
|
|
|
|
static_cast<uint32_t>(awe->TagIndex),
|
|
|
|
static_cast<uint32_t>(awe->Characteristics));
|
2015-12-20 17:54:34 +08:00
|
|
|
} else {
|
|
|
|
outs() << "AUX Unknown\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-15 23:31:42 +08:00
|
|
|
} // namespace llvm
|