Calling convention on x64

64-bit, calling-convention, compiler-construction, x86-64

Solution

I just found the answer here and here. Basically, Windows does it one way, everyone else does it another way, but each platform only does it one way (as opposed to multiple ways per-platform with `x86`)

Problem

I saw in several places that Microsoft calling conventions for `x64` platforms were narrowed down to just one: Caller cleans stack (`cdecl`), and parameters are passed in a combination of stack and registers (I am not going into the exact details here). I assume that if this is the calling convention of the OS, then probably all other compilers targeting Windows (e.g. mingw-w64) follow it, too. Is this calling convention true also on other major platforms (`x64` Linux, etc.)? Or does Linux still use multiple calling conventions, or even just one but a different one? Do `GCC` or `Clang` allow for multiple calling conventions on `x64` Linux?

Original source

Related problems