[PATCH] D36548: [llvm-dlltool] Fix creating stdcall import libraries for MinGW/i386

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 14:02:55 PDT 2017

mstorsjo added inline comments.

Comment at: lib/Object/COFFModuleDefinition.cpp:232
+        E.SymbolName = E.Name;
+        E.Name = E.Name.substr(0, E.Name.find('@'));
+      }
rnk wrote:
> mstorsjo wrote:
> > rnk wrote:
> > > Surely this doesn't work for fastcall functions, though? They look like @foo at 4
> > Hmm, indeed, that's true. Haven't seen such, but they are used in mingw so they clearly need to be handled.
> > 
> > I think it would work with just using `rfind` instead of `find`, what do you think?
> > 
> > Unrelatedly - do you think we should move this whole block into the dlltool driver instead, since it's mingw specific? We could do a pass over the exports after parsing the def, before passing it to the writer.
> Unfortunately, vectorcall messes `rfind` up, it does foo@@4: https://msdn.microsoft.com/en-us/library/deaxefa7.aspx
Ah, crap. Mingw-w64 doesn't seem to have any such functions in the def files though. But I'd rather make it handle them correctly at the same time in any case.

Wouldn't the existing check for `isDecorated` above also prepend an underscore to it (even though there shouldn't be any, according to that ref)?


More information about the llvm-commits mailing list