[lld] r311098 - Merging rr310989:

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 09:58:21 PDT 2017


Author: hans
Date: Thu Aug 17 09:58:21 2017
New Revision: 311098

URL: http://llvm.org/viewvc/llvm-project?rev=311098&view=rev
Log:
Merging rr310989:
------------------------------------------------------------------------
r310989 | mstorsjo | 2017-08-15 22:13:25 -0700 (Tue, 15 Aug 2017) | 18 lines

[COFF] Fix the name type for stdcall functions in import libraries

Since SVN r303491 and r304573, LLD used the COFFImportLibrary
functions from LLVM. These only had two names, Name and ExtName,
which wasn't enough to convey all the details of stdcall functions.

Stdcall functions got the wrong symbol name in the import library
itself in r303491, which is why it was reverted in r304561. When
re-landed and fixed in r304573 (after adding a test in r304572),
the symbol name itself in the import library ended up right, but the
name type of the import library entry was wrong.

This had the effect that linking to the import library succeeded
(contrary to in r303491, where linking to such an import library
failed), but at runtime, the symbol wouldn't be found in the DLL
(since the caller linked to the stdcall decorated name).

Differential Revision: https://reviews.llvm.org/D36545
------------------------------------------------------------------------

Modified:
    lld/branches/release_50/   (props changed)
    lld/branches/release_50/COFF/Driver.cpp
    lld/branches/release_50/test/COFF/def-export-stdcall.s

Propchange: lld/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 17 09:58:21 2017
@@ -1 +1 @@
-/lld/trunk:308492,308728,308935,308998,309002,310526
+/lld/trunk:308492,308728,308935,308998,309002,310526,310989

Modified: lld/branches/release_50/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_50/COFF/Driver.cpp?rev=311098&r1=311097&r2=311098&view=diff
==============================================================================
--- lld/branches/release_50/COFF/Driver.cpp (original)
+++ lld/branches/release_50/COFF/Driver.cpp Thu Aug 17 09:58:21 2017
@@ -458,8 +458,8 @@ static void createImportLibrary(bool AsL
   std::vector<COFFShortExport> Exports;
   for (Export &E1 : Config->Exports) {
     COFFShortExport E2;
-    // Use SymbolName, which will have any stdcall or fastcall qualifiers.
-    E2.Name = E1.SymbolName;
+    E2.Name = E1.Name;
+    E2.SymbolName = E1.SymbolName;
     E2.ExtName = E1.ExtName;
     E2.Ordinal = E1.Ordinal;
     E2.Noname = E1.Noname;

Modified: lld/branches/release_50/test/COFF/def-export-stdcall.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_50/test/COFF/def-export-stdcall.s?rev=311098&r1=311097&r2=311098&view=diff
==============================================================================
--- lld/branches/release_50/test/COFF/def-export-stdcall.s (original)
+++ lld/branches/release_50/test/COFF/def-export-stdcall.s Thu Aug 17 09:58:21 2017
@@ -2,7 +2,8 @@
 # RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o %t.obj
 # RUN: echo -e "LIBRARY foo\nEXPORTS\n  stdcall" > %t.def
 # RUN: lld-link -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
-# RUN: llvm-nm %t.lib | FileCheck %s
+# RUN: llvm-readobj %t.lib | FileCheck %s
+# CHECK: Name type: undecorate
 # CHECK: __imp__stdcall at 8
 # CHECK: _stdcall at 8
 




More information about the llvm-commits mailing list