]> granicus.if.org Git - llvm/commitdiff
[llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports
authorMartin Storsjo <martin@martin.st>
Fri, 23 Aug 2019 11:18:11 +0000 (11:18 +0000)
committerMartin Storsjo <martin@martin.st>
Fri, 23 Aug 2019 11:18:11 +0000 (11:18 +0000)
ExtName should not be decorated, just like Name.

This avoids double decoration on symbols in import libraries
that use = for renaming functions. (Weak aliases, which use ==,
worked fine with respect to decoration.)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369747 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
test/tools/llvm-dlltool/coff-decorated.def

index 603ba826e5efe74654e49fb357cf497d3b14071d..3b8b25d7ecadb0cf70d18c7b624ecca48f2a3eba 100644 (file)
@@ -171,6 +171,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
       // 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));
     }
   }
 
index 3885abca836fd5566d524adc413c1c82138708e9..e1ca3cbe2d0a0cb808db4b435f0dffd2f95dcb21 100644 (file)
@@ -9,6 +9,7 @@ StdcallFunction@4
 @FastcallFunction@4
 StdcallAlias@4==StdcallFunction@4
 ??_7exception@@6B@
+StdcallExportName@4=StdcallInternalFunction@4
 
 ; CHECK: Name type: noprefix
 ; CHECK: Symbol: __imp__CdeclFunction
@@ -24,3 +25,5 @@ StdcallAlias@4==StdcallFunction@4
 ; CHECK: Symbol: ??_7exception@@6B@
 ; CHECK-NM: W _StdcallAlias@4
 ; CHECK-NM: U _StdcallFunction@4
+; CHECK: Symbol: __imp__StdcallExportName@4{{$}}
+; CHECK: Symbol: _StdcallExportName@4{{$}}