1 //===-- COFFImportDumper.cpp - COFF import library dumper -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This file implements the COFF import library dumper for llvm-readobj.
13 //===----------------------------------------------------------------------===//
16 #include "ObjDumper.h"
17 #include "llvm-readobj.h"
18 #include "llvm/BinaryFormat/COFF.h"
19 #include "llvm/Object/COFF.h"
20 #include "llvm/Object/COFFImportFile.h"
22 using namespace llvm::object
;
26 void dumpCOFFImportFile(const COFFImportFile
*File
) {
28 outs() << "File: " << File
->getFileName() << "\n";
29 outs() << "Format: COFF-import-file\n";
31 const coff_import_header
*H
= File
->getCOFFImportHeader();
32 switch (H
->getType()) {
33 case COFF::IMPORT_CODE
: outs() << "Type: code\n"; break;
34 case COFF::IMPORT_DATA
: outs() << "Type: data\n"; break;
35 case COFF::IMPORT_CONST
: outs() << "Type: const\n"; break;
38 switch (H
->getNameType()) {
39 case COFF::IMPORT_ORDINAL
: outs() << "Name type: ordinal\n"; break;
40 case COFF::IMPORT_NAME
: outs() << "Name type: name\n"; break;
41 case COFF::IMPORT_NAME_NOPREFIX
: outs() << "Name type: noprefix\n"; break;
42 case COFF::IMPORT_NAME_UNDECORATE
: outs() << "Name type: undecorate\n"; break;
45 for (const object::BasicSymbolRef
&Sym
: File
->symbols()) {
47 Sym
.printName(outs());