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.

llvm-svn: 246535
This commit is contained in:
Rui Ueyama 2015-09-01 08:08:57 +00:00
parent 6307849666
commit dfff2542b8
2 changed files with 7 additions and 13 deletions

View File

@ -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;

View File

@ -74,9 +74,9 @@ CHECK6-NOT: duplicate /export option: exportfn1
# 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
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