2015-08-28 12:27:50 +02:00
|
|
|
//===-- COFFImportDumper.cpp - COFF import library dumper -------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file
|
2018-05-01 17:54:18 +02:00
|
|
|
/// This file implements the COFF import library dumper for llvm-readobj.
|
2015-08-28 12:27:50 +02:00
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-06-07 05:48:56 +02:00
|
|
|
#include "llvm/BinaryFormat/COFF.h"
|
2015-08-28 12:27:50 +02:00
|
|
|
#include "llvm/Object/COFF.h"
|
|
|
|
#include "llvm/Object/COFFImportFile.h"
|
2018-01-10 01:14:19 +01:00
|
|
|
#include "llvm/Support/ScopedPrinter.h"
|
2015-08-28 12:27:50 +02:00
|
|
|
|
|
|
|
using namespace llvm::object;
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2018-01-10 01:14:19 +01:00
|
|
|
void dumpCOFFImportFile(const COFFImportFile *File, ScopedPrinter &Writer) {
|
|
|
|
Writer.startLine() << '\n';
|
|
|
|
Writer.printString("File", File->getFileName());
|
|
|
|
Writer.printString("Format", "COFF-import-file");
|
2015-08-28 12:27:50 +02:00
|
|
|
|
|
|
|
const coff_import_header *H = File->getCOFFImportHeader();
|
|
|
|
switch (H->getType()) {
|
2018-01-10 01:14:19 +01:00
|
|
|
case COFF::IMPORT_CODE: Writer.printString("Type", "code"); break;
|
|
|
|
case COFF::IMPORT_DATA: Writer.printString("Type", "data"); break;
|
|
|
|
case COFF::IMPORT_CONST: Writer.printString("Type", "const"); break;
|
2015-08-28 12:27:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (H->getNameType()) {
|
2018-01-10 01:14:19 +01:00
|
|
|
case COFF::IMPORT_ORDINAL:
|
|
|
|
Writer.printString("Name type", "ordinal");
|
|
|
|
break;
|
|
|
|
case COFF::IMPORT_NAME:
|
|
|
|
Writer.printString("Name type", "name");
|
|
|
|
break;
|
|
|
|
case COFF::IMPORT_NAME_NOPREFIX:
|
|
|
|
Writer.printString("Name type", "noprefix");
|
|
|
|
break;
|
|
|
|
case COFF::IMPORT_NAME_UNDECORATE:
|
|
|
|
Writer.printString("Name type", "undecorate");
|
|
|
|
break;
|
2015-08-28 12:27:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (const object::BasicSymbolRef &Sym : File->symbols()) {
|
2018-01-10 01:14:19 +01:00
|
|
|
raw_ostream &OS = Writer.startLine();
|
|
|
|
OS << "Symbol: ";
|
|
|
|
Sym.printName(OS);
|
|
|
|
OS << "\n";
|
2015-08-28 12:27:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace llvm
|