[PATCH] D66996: [llvm-dlltool] Handle external and internal names with differing decoration
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 2 06:27:02 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370656: [llvm-dlltool] Handle external and internal names with differing decoration (authored by mstorsjo, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D66996?vs=218067&id=218353#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66996/new/
https://reviews.llvm.org/D66996
Files:
llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
llvm/trunk/test/tools/llvm-dlltool/coff-decorated.def
Index: llvm/trunk/test/tools/llvm-dlltool/coff-decorated.def
===================================================================
--- llvm/trunk/test/tools/llvm-dlltool/coff-decorated.def
+++ llvm/trunk/test/tools/llvm-dlltool/coff-decorated.def
@@ -10,6 +10,8 @@
StdcallAlias at 4==StdcallFunction at 4
??_7exception@@6B@
StdcallExportName at 4=StdcallInternalFunction at 4
+OtherStdcallExportName at 4=CdeclInternalFunction
+CdeclExportName=StdcallInternalFunction at 4
; CHECK: Name type: noprefix
; CHECK: Symbol: __imp__CdeclFunction
@@ -25,5 +27,12 @@
; CHECK: Symbol: ??_7exception@@6B@
; CHECK-NM: W _StdcallAlias at 4
; CHECK-NM: U _StdcallFunction at 4
+; CHECK: Name type: undecorate
; CHECK: Symbol: __imp__StdcallExportName at 4{{$}}
; CHECK: Symbol: _StdcallExportName at 4{{$}}
+; CHECK: Name type: undecorate
+; CHECK: Symbol: __imp__OtherStdcallExportName at 4{{$}}
+; CHECK: Symbol: _OtherStdcallExportName at 4{{$}}
+; CHECK: Name type: noprefix
+; CHECK: Symbol: __imp__CdeclExportName
+; CHECK: Symbol: _CdeclExportName
Index: llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
===================================================================
--- llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
+++ llvm/trunk/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
@@ -148,6 +148,18 @@
std::string Path = Args.getLastArgValue(OPT_l);
+ // If ExtName is set (if the "ExtName = Name" syntax was used), overwrite
+ // Name with ExtName and clear ExtName. When only creating an import
+ // library and not linking, the internal name is irrelevant. This avoids
+ // cases where writeImportLibrary tries to transplant decoration from
+ // symbol decoration onto ExtName.
+ for (COFFShortExport& E : Def->Exports) {
+ if (!E.ExtName.empty()) {
+ E.Name = E.ExtName;
+ E.ExtName.clear();
+ }
+ }
+
if (Machine == IMAGE_FILE_MACHINE_I386 && Args.getLastArg(OPT_k)) {
for (COFFShortExport& E : Def->Exports) {
if (!E.AliasTarget.empty() || (!E.Name.empty() && E.Name[0] == '?'))
@@ -162,7 +174,6 @@
// By making sure E.SymbolName != E.Name for decorated symbols,
// writeImportLibrary writes these symbols with the type
// IMPORT_NAME_UNDECORATE.
- E.ExtName = E.ExtName.substr(0, E.ExtName.find('@', 1));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66996.218353.patch
Type: text/x-patch
Size: 2289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190902/75e9119d/attachment.bin>
More information about the llvm-commits
mailing list