[PATCH] D84465: [llvm-lib] Support adding short import library objects with llvm-lib

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 12:15:26 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4d09ed953b5b: [llvm-lib] Support adding short import library objects with llvm-lib (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D84465?vs=280252&id=280548#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84465/new/

https://reviews.llvm.org/D84465

Files:
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/test/tools/llvm-lib/implibs.test
  llvm/test/tools/llvm-lib/invalid.test


Index: llvm/test/tools/llvm-lib/invalid.test
===================================================================
--- llvm/test/tools/llvm-lib/invalid.test
+++ llvm/test/tools/llvm-lib/invalid.test
@@ -1,2 +1,2 @@
 RUN: not llvm-lib %S/Inputs/cl-gl.obj 2>&1 | FileCheck %s
-CHECK: not a COFF object, bitcode, archive or resource file
+CHECK: not a COFF object, bitcode, archive, import library or resource file
Index: llvm/test/tools/llvm-lib/implibs.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-lib/implibs.test
@@ -0,0 +1,12 @@
+Test that import libraries (and the members thereof) can be added to another
+static library.
+
+RUN: rm -rf %t
+RUN: mkdir -p %t
+
+RUN: echo -e "EXPORTS\nMyFunc" > %t/lib.def
+RUN: llvm-dlltool -m i386:x86-64 -l %t/lib.lib -d %t/lib.def -D lib.dll
+RUN: llvm-lib -out:%t/newlib.lib %t/lib.lib
+
+RUN: llvm-ar t %t/newlib.lib | FileCheck %s
+CHECK: lib.dll
Index: llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
===================================================================
--- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
+++ llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
@@ -191,9 +191,11 @@
   file_magic Magic = identify_magic(MB.getBuffer());
 
   if (Magic != file_magic::coff_object && Magic != file_magic::bitcode &&
-      Magic != file_magic::archive && Magic != file_magic::windows_resource) {
+      Magic != file_magic::archive && Magic != file_magic::windows_resource &&
+      Magic != file_magic::coff_import_library) {
     llvm::errs() << MB.getBufferIdentifier()
-                 << ": not a COFF object, bitcode, archive or resource file\n";
+                 << ": not a COFF object, bitcode, archive, import library or "
+                    "resource file\n";
     exit(1);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84465.280548.patch
Type: text/x-patch
Size: 1802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200724/58df5738/attachment.bin>


More information about the llvm-commits mailing list