Skip to content

Commit

Permalink
[llvm-dlltool] Make sure to strip decorations from ExtName for rename…
Browse files Browse the repository at this point in the history
…d exports

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

llvm-svn: 369747
  • Loading branch information
mstorsjo committed Aug 23, 2019
1 parent 04906ef commit 8dbdb1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
3 changes: 3 additions & 0 deletions llvm/test/tools/llvm-dlltool/coff-decorated.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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{{$}}

0 comments on commit 8dbdb1c

Please sign in to comment.