summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/COFFModuleDefinition.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2017-08-16 05:18:36 +0000
committerMartin Storsjo <martin@martin.st>2017-08-16 05:18:36 +0000
commit58c9527eaf4f48f01718d5eea9409d1bf44878ce (patch)
treea0e97fcd4ed3b8d858be1f304ed072ccb96fba10 /llvm/lib/Object/COFFModuleDefinition.cpp
parenta50275cfe5236c39d284afae40866b0747e0bcc4 (diff)
downloadbcm5719-llvm-58c9527eaf4f48f01718d5eea9409d1bf44878ce.tar.gz
bcm5719-llvm-58c9527eaf4f48f01718d5eea9409d1bf44878ce.zip
[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
Diffstat (limited to 'llvm/lib/Object/COFFModuleDefinition.cpp')
-rw-r--r--llvm/lib/Object/COFFModuleDefinition.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFModuleDefinition.cpp b/llvm/lib/Object/COFFModuleDefinition.cpp
index ed9140d1fe0..510eac8b239 100644
--- a/llvm/lib/Object/COFFModuleDefinition.cpp
+++ b/llvm/lib/Object/COFFModuleDefinition.cpp
@@ -232,7 +232,13 @@ private:
for (;;) {
read();
if (Tok.K == Identifier && Tok.Value[0] == '@') {
- Tok.Value.drop_front().getAsInteger(10, E.Ordinal);
+ if (Tok.Value.drop_front().getAsInteger(10, E.Ordinal)) {
+ // Not an ordinal modifier at all, but the next export (fastcall
+ // decorated) - complete the current one.
+ unget();
+ Info.Exports.push_back(E);
+ return Error::success();
+ }
read();
if (Tok.K == KwNoname) {
E.Noname = true;
OpenPOWER on IntegriCloud