[lld] r310992 - [COFF] Don't produce weak aliases in import libraries

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 22:23:00 PDT 2017


Author: mstorsjo
Date: Tue Aug 15 22:23:00 2017
New Revision: 310992

URL: http://llvm.org/viewvc/llvm-project?rev=310992&view=rev
Log:
[COFF] Don't produce weak aliases in import libraries

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.

Differential Revision: https://reviews.llvm.org/D36634

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

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=310992&r1=310991&r2=310992&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Tue Aug 15 22:23:00 2017
@@ -473,7 +473,7 @@ static void createImportLibrary(bool AsL
   }
 
   writeImportLibrary(getImportName(AsLib), getImplibPath(), Exports,
-                     Config->Machine);
+                     Config->Machine, false);
 }
 
 static void parseModuleDefs(StringRef Path) {

Modified: lld/trunk/test/COFF/export.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/export.test?rev=310992&r1=310991&r2=310992&view=diff
==============================================================================
--- lld/trunk/test/COFF/export.test (original)
+++ lld/trunk/test/COFF/export.test Tue Aug 15 22:23:00 2017
@@ -39,8 +39,9 @@ CHECK3-NEXT:       4        0
 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
@@ -49,6 +50,8 @@ 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




More information about the llvm-commits mailing list