Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-dlltool] Fix creating stdcall/fastcall import libraries for i386
Hook up the -k option (that in the original GNU dlltool removes the @n suffix from the symbol that the final executable ends up linked to). In llvm-dlltool, make sure that functions end up with the undecorate name type if this option is set and they are decorated. In mingw, when creating import libraries from def files instead of creating an import library as a side effect of linking a DLL, the symbol names in the def contain the stdcall/fastcall decoration (but no leading underscore). By setting the undecorate name type, a linker linking to the import library will omit the decoration from the DLL import entry. With this in place, mingw-w64 for i386 built with llvm-dlltool/clang produces import libraries that actually work. Differential Revision: https://reviews.llvm.org/D36548 llvm-svn: 310990
- Loading branch information
Showing
4 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; RUN: llvm-dlltool -k -m i386 --input-def %s --output-lib %t.a | ||
; RUN: llvm-readobj %t.a | FileCheck %s | ||
; RUN: llvm-nm %t.a | FileCheck %s -check-prefix=CHECK-NM | ||
|
||
LIBRARY test.dll | ||
EXPORTS | ||
CdeclFunction | ||
StdcallFunction@4 | ||
@FastcallFunction@4 | ||
StdcallAlias@4=StdcallFunction@4 | ||
??_7exception@@6B@ | ||
|
||
; CHECK: Name type: noprefix | ||
; CHECK: Symbol: __imp__CdeclFunction | ||
; CHECK: Symbol: _CdeclFunction | ||
; CHECK: Name type: undecorate | ||
; CHECK: Symbol: __imp__StdcallFunction@4 | ||
; CHECK: Symbol: _StdcallFunction@4 | ||
; CHECK: Name type: undecorate | ||
; CHECK: Symbol: __imp_@FastcallFunction@4 | ||
; CHECK: Symbol: @FastcallFunction@4 | ||
; CHECK: Name type: name | ||
; CHECK: Symbol: __imp_??_7exception@@6B@ | ||
; CHECK: Symbol: ??_7exception@@6B@ | ||
; CHECK-NM: w _StdcallAlias@4 | ||
; CHECK-NM: U _StdcallFunction@4 |