LDC calling convention

Radu void at null.pt
Tue Apr 9 11:25:45 UTC 2019


On Tuesday, 9 April 2019 at 08:58:00 UTC, Alexandru Militaru 
wrote:
> Hello!
>
> I am trying to port a kernel module to D and I am using LDC to 
> compile the code. I want to call a function with 7 arguments 
> and after some debugging sessions I’ve observed that the second 
> argument has a different value in the callee function than the 
> one I am passing in the caller function. After I’ve inspected 
> with objdump the kernel module it seems to me that the LDC 
> places the parameters in registers in a weird order. Note that 
> the calling convention was fine until now and everything 
> worked. Maybe the problem is that the function has 7 arguments. 
> In the kernel, the calling convention is: first 6 arguments in 
> rdi, rsi, rdx, rcx, r8, r9 and then on the stack.
>
> [...]

The calling convention will be System V AMD64 ABI - a quick test 
shows that LDC passes the arguments in the expected order.

https://godbolt.org/z/0H1yD5



More information about the digitalmars-d-ldc mailing list