Index: llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp =================================================================== --- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -191,7 +191,8 @@ 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"; exit(1); 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