[llvm] r279069 - llvm-readobj: handle import libraries with -coff-exports

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 07:32:12 PDT 2016


Author: compnerd
Date: Thu Aug 18 09:32:11 2016
New Revision: 279069

URL: http://llvm.org/viewvc/llvm-project?rev=279069&view=rev
Log:
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.

Added:
    llvm/trunk/test/tools/llvm-readobj/Inputs/library.lib   (with props)
    llvm/trunk/test/tools/llvm-readobj/coff-exports-implib.test
Modified:
    llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp

Added: llvm/trunk/test/tools/llvm-readobj/Inputs/library.lib
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/library.lib?rev=279069&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-readobj/Inputs/library.lib (added) and llvm/trunk/test/tools/llvm-readobj/Inputs/library.lib Thu Aug 18 09:32:11 2016 differ

Propchange: llvm/trunk/test/tools/llvm-readobj/Inputs/library.lib
------------------------------------------------------------------------------
    svn:executable = *

Added: llvm/trunk/test/tools/llvm-readobj/coff-exports-implib.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/coff-exports-implib.test?rev=279069&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/coff-exports-implib.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/coff-exports-implib.test Thu Aug 18 09:32:11 2016
@@ -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
+

Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=279069&r1=279068&r2=279069&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Thu Aug 18 09:32:11 2016
@@ -460,6 +460,8 @@ static void dumpArchive(const Archive *A
     }
     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);
   }




More information about the llvm-commits mailing list