llvm-readobj: handle import libraries with -coff-exports

`link -dump -exports` lists exported symbols from import libraries as well as
normal dlls.  Ensure that we can handle import libraries as well in
llvm-readobj.

llvm-svn: 279069
This commit is contained in:
Saleem Abdulrasool 2016-08-18 14:32:11 +00:00
parent 7d37b221a2
commit 3780b3a9eb
3 changed files with 24 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,22 @@
RUN: llvm-readobj -coff-exports %p/Inputs/library.lib | FileCheck %s
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: const
CHECK: Symbol: __imp__constant
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: data
CHECK: Symbol: __imp__data
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: code
CHECK: Symbol: __imp__function
CHECK: File: library.dll
CHECK: Format: COFF-import-file
CHECK: Type: code
CHECK: Symbol: __imp__ordinal

View File

@ -460,6 +460,8 @@ static void dumpArchive(const Archive *Arc) {
}
if (ObjectFile *Obj = dyn_cast<ObjectFile>(&*ChildOrErr.get()))
dumpObject(Obj);
else if (COFFImportFile *Imp = dyn_cast<COFFImportFile>(&*ChildOrErr.get()))
dumpCOFFImportFile(Imp);
else
reportError(Arc->getFileName(), readobj_error::unrecognized_file_format);
}