Stream: cranelift

Topic: ✔ Cranelift cdecl abi


view this post on Zulip Cherry (Jun 16 2024 at 21:17):

(Note, using Windows x86_64)

I've been looking in the list of abi's for cranelift, which for stable abi's supports fastcall and systemv (as far as I understand).

I'm looking to make my JIT function callable from a cdecl abi. Is there a way to do this, or is there something obvious I'm missing? I have been looking online and see some people say cdecl == fastcall == stdcall, but I look at the abi docs and they seem to be slightly different, e.g. caller or callee cleans up stack, which I would think should be pretty crucial things. So I'm not sure if I can rely on the advice that "cdecl == fastcall".

What am I missing here?

Edit: Just to be clear, I'm talking about CallConv

view this post on Zulip Alex Rønne Petersen (Jun 16 2024 at 21:23):

It is correct that cdecl == stdcall == fastcall on Windows x86-64. There is basically only one calling convention there (if you ignore vectorcall anyway).

If you look at the MSVC documentation, it explicitly states that these CC modifiers are ignored on x64. (IIRC the only exception is that cdecl can be used as an override if you've told the compiler to default to vectorcall.)

view this post on Zulip Cherry (Jun 17 2024 at 01:01):

Alex Rønne Petersen said:

It is correct that cdecl == stdcall == fastcall on Windows x86-64. There is basically only one calling convention there (if you ignore vectorcall anyway).

Thank you for clarifying this point!

view this post on Zulip Notification Bot (Jun 17 2024 at 17:37):

This topic was moved here from #general > Cranelift cdecl abi by fitzgen (he/him).

view this post on Zulip Notification Bot (Jun 20 2024 at 00:52):

Cherry has marked this topic as resolved.


Last updated: Oct 23 2024 at 20:03 UTC