[PATCH] D87701: Do not apply calling conventions to MSVC entry points

Elizabeth Andrews via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 14:25:14 PDT 2020


eandrews added a comment.

In D87701#2280246 <https://reviews.llvm.org/D87701#2280246>, @dmajor wrote:

> This broke Firefox builds too, in one of our helper binaries that uses a `wWinMain`, although I'm having trouble writing a minimal reproducer for it. Simply making a barebones `wWinMain` program doesn't hit the error.
>
> If the patch re-lands, please cc me and I'll re-test.

Will do.  I think MSVC applies calling conventions to entry points when it is specified in function signature.

  int WinMain(int argc) {return 1;}

Compiling this with /Gr generates symbol ` _WinMain at 4` , meaning `/Gr` was ignored and fastcall was not applied to WinMain.  But,

  int __fastcall WinMain(int argc) {return 1;}

generates symbol ` @WinMain at 4`, meaning __fastcall calling convention was applied to WinMain.

It also looks like stdcall is default calling convention for WinMain.

Anyway, I'll upload a new patch for review once I understand the required behavior better.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87701/new/

https://reviews.llvm.org/D87701



More information about the cfe-commits mailing list