[PATCH] D36634: [lld] [COFF] Don't produce weak aliases in import libraries

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 13:02:00 PDT 2017


mstorsjo created this revision.
Herald added a subscriber: mehdi_amini.

When creating an import library from lld, the cases with Name != ExtName shouldn't end up as a weak alias, but as a real export of the new name, which is what actually is exported from the DLL.

This restores the behaviour of renamed exports to what it was in 4.0 - this is a regression since the introduction of llvm-dlltool.


https://reviews.llvm.org/D36634

Files:
  COFF/Driver.cpp
  test/COFF/export.test


Index: test/COFF/export.test
===================================================================
--- test/COFF/export.test
+++ test/COFF/export.test
@@ -39,16 +39,19 @@
 CHECK3-NEXT:       5   0x1008
 CHECK3-NEXT:       6   0x1010  exportfn2
 
-# RUN: lld-link /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2
+# RUN: lld-link /out:%t.dll /dll %t.obj /export:f1=exportfn1 /export:f2=exportfn2 /implib:%t.lib
 # RUN: llvm-objdump -p %t.dll | FileCheck -check-prefix=CHECK4 %s
+# RUN: llvm-nm %t.lib | FileCheck -check-prefix=CHECK4-NM %s
 
 CHECK4:      Export Table:
 CHECK4:      DLL name: export.test.tmp.dll
 CHECK4:      Ordinal      RVA  Name
 CHECK4-NEXT:       0        0
 CHECK4-NEXT:       1   0x1010  exportfn3
 CHECK4-NEXT:       2   0x1008  f1
 CHECK4-NEXT:       3   0x1010  f2
+CHECK4-NM: 00000000 T f1
+CHECK4-NM: 00000000 T f2
 
 # RUN: echo "EXPORTS exportfn1 @3" > %t.def
 # RUN: echo "fn2=exportfn2 @2" >> %t.def
Index: COFF/Driver.cpp
===================================================================
--- COFF/Driver.cpp
+++ COFF/Driver.cpp
@@ -473,7 +473,7 @@
   }
 
   writeImportLibrary(getImportName(AsLib), getImplibPath(), Exports,
-                     Config->Machine);
+                     Config->Machine, false);
 }
 
 static void parseModuleDefs(StringRef Path) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36634.110793.patch
Type: text/x-patch
Size: 1316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170811/f51eebf8/attachment.bin>


More information about the llvm-commits mailing list