summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-08-23 11:18:11 +0000
committerMartin Storsjo <martin@martin.st>2019-08-23 11:18:11 +0000
commit8dbdb1c2a2cb9bd22db271fd14350de1486a9b49 (patch)
tree75e4cf918cbb6501c48275de0bb592b3103f2089
parent04906ef1f2f443a2ff31a919dc67576f593ad891 (diff)
downloadbcm5719-llvm-8dbdb1c2a2cb9bd22db271fd14350de1486a9b49.tar.gz
bcm5719-llvm-8dbdb1c2a2cb9bd22db271fd14350de1486a9b49.zip
[llvm-dlltool] Make sure to strip decorations from ExtName for renamed 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
-rw-r--r--llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp1
-rw-r--r--llvm/test/tools/llvm-dlltool/coff-decorated.def3
2 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
index 603ba826e5e..3b8b25d7eca 100644
--- a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
+++ b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
@@ -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));
}
}
diff --git a/llvm/test/tools/llvm-dlltool/coff-decorated.def b/llvm/test/tools/llvm-dlltool/coff-decorated.def
index 3885abca836..e1ca3cbe2d0 100644
--- a/llvm/test/tools/llvm-dlltool/coff-decorated.def
+++ b/llvm/test/tools/llvm-dlltool/coff-decorated.def
@@ -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{{$}}
OpenPOWER on IntegriCloud