[lld] r246535 - COFF: Make import libraries compatible with MSVC link.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 01:08:58 PDT 2015


Author: ruiu
Date: Tue Sep  1 03:08:57 2015
New Revision: 246535

URL: http://llvm.org/viewvc/llvm-project?rev=246535&view=rev
Log:
COFF: Make import libraries compatible with MSVC link.

I have totally no idea why, but MSVC linker is sensitive about
file names of archive members. If we do not make import library
file names to the same as the DLL name, MSVC link *crashes*
when it is processing the library file. This patch is to set
the same name.

Modified:
    lld/trunk/COFF/DriverUtils.cpp
    lld/trunk/test/COFF/export.test

Modified: lld/trunk/COFF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=246535&r1=246534&r2=246535&view=diff
==============================================================================
--- lld/trunk/COFF/DriverUtils.cpp (original)
+++ lld/trunk/COFF/DriverUtils.cpp Tue Sep  1 03:08:57 2015
@@ -572,16 +572,10 @@ public:
     memcpy(P, DLLName.data(), DLLName.size());
 
     object::Archive::Child C(Parent, Buf);
-    return NewArchiveIterator(C, nextFilename());
+    return NewArchiveIterator(C, DLLName);
   }
 
 private:
-  char *nextFilename() {
-    char *P = Alloc.Allocate<char>(16);
-    sprintf(P, "%d.obj", Idx++);
-    return P;
-  }
-
   BumpPtrAllocator Alloc;
   object::Archive *Parent;
   StringRef DLLName;

Modified: lld/trunk/test/COFF/export.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/export.test?rev=246535&r1=246534&r2=246535&view=diff
==============================================================================
--- lld/trunk/test/COFF/export.test (original)
+++ lld/trunk/test/COFF/export.test Tue Sep  1 03:08:57 2015
@@ -74,9 +74,9 @@ CHECK6-NOT: duplicate /export option: ex
 
 # RUN: llvm-nm -M %t.lib | FileCheck --check-prefix=SYMTAB %s
 
-SYMTAB: __imp_exportfn1 in 1.obj
-SYMTAB: exportfn1 in 1.obj
-SYMTAB: __imp_exportfn2 in 2.obj
-SYMTAB: exportfn2 in 2.obj
-SYMTAB: __imp_exportfn3 in 3.obj
-SYMTAB: exportfn3 in 3.obj
\ No newline at end of file
+SYMTAB: __imp_exportfn1 in export.test.tmp.dll
+SYMTAB: exportfn1 in export.test.tmp.dll
+SYMTAB: __imp_exportfn2 in export.test.tmp.dll
+SYMTAB: exportfn2 in export.test.tmp.dll
+SYMTAB: __imp_exportfn3 in export.test.tmp.dll
+SYMTAB: exportfn3 in export.test.tmp.dll




More information about the llvm-commits mailing list