mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-15 07:59:57 +00:00
19ca2b0f9d
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304864 91177308-0d34-0410-b5e6-96231b3b80d8
53 lines
1.6 KiB
C++
53 lines
1.6 KiB
C++
//===-- 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
|
|
/// \brief This file implements the COFF import library dumper for llvm-readobj.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "Error.h"
|
|
#include "ObjDumper.h"
|
|
#include "llvm-readobj.h"
|
|
#include "llvm/BinaryFormat/COFF.h"
|
|
#include "llvm/Object/COFF.h"
|
|
#include "llvm/Object/COFFImportFile.h"
|
|
|
|
using namespace llvm::object;
|
|
|
|
namespace llvm {
|
|
|
|
void dumpCOFFImportFile(const COFFImportFile *File) {
|
|
outs() << '\n';
|
|
outs() << "File: " << File->getFileName() << "\n";
|
|
outs() << "Format: COFF-import-file\n";
|
|
|
|
const coff_import_header *H = File->getCOFFImportHeader();
|
|
switch (H->getType()) {
|
|
case COFF::IMPORT_CODE: outs() << "Type: code\n"; break;
|
|
case COFF::IMPORT_DATA: outs() << "Type: data\n"; break;
|
|
case COFF::IMPORT_CONST: outs() << "Type: const\n"; break;
|
|
}
|
|
|
|
switch (H->getNameType()) {
|
|
case COFF::IMPORT_ORDINAL: outs() << "Name type: ordinal\n"; break;
|
|
case COFF::IMPORT_NAME: outs() << "Name type: name\n"; break;
|
|
case COFF::IMPORT_NAME_NOPREFIX: outs() << "Name type: noprefix\n"; break;
|
|
case COFF::IMPORT_NAME_UNDECORATE: outs() << "Name type: undecorate\n"; break;
|
|
}
|
|
|
|
for (const object::BasicSymbolRef &Sym : File->symbols()) {
|
|
outs() << "Symbol: ";
|
|
Sym.printName(outs());
|
|
outs() << "\n";
|
|
}
|
|
}
|
|
|
|
} // namespace llvm
|