Bug 20204 – need to fix ABI about registers using

Status
NEW
Severity
normal
Priority
P3
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-09-10T09:00:57Z
Last change time
2024-12-15T15:25:20Z
Keywords
pull
Assigned to
No Owner
Creator
a11e99z
Moved to GitHub: dlang.org#3979 →

Comments

Comment #0 by black80 — 2019-09-10T09:00:57Z
https://dlang.org/spec/abi.html#register_conventions D calling convention (for Linux/x64 in my case) uses registers in backward order. https://run.dlang.io/gist/run-dlang/7ed10bc2450b747cb65fdfbf6e375629 but such important info is missing from page about D register conventions. no info about x64 registers at all, and I can not find "reverse" or "backward" words too (I didnt read all page, just for registers)
Comment #1 by black80 — 2019-09-10T09:18:25Z
I mean need to fix documentation and add some samples that shows which registers will be used for it in Linux, Windows, _x64, ARM... like Linux/x64 convention uses RDI, RSI, RDX, RCX, R8, R9 for args left-to-right but D uses same registers for args right-to-left: extern (C) func( long a, long b, long c ) => C/Linux: RDI, RSI, RDX extern (D) func( long a, long b, long c ) => C/Linux: RDX, RSI, RDI
Comment #2 by dlang-bot — 2021-11-09T18:01:57Z
@ljmf00 created dlang/dlang.org pull request #3120 "spec: abi: clarify calling convention for other architectures other t…" fixing this issue: - spec: abi: clarify calling convention for other architectures other than x86 Observing the assembly generated by the following source file in either DMD and LDC: ```d extern (C) void ccall( size_t a, size_t b, size_t c ); extern (D) void dcall( size_t a, size_t b, size_t c ); //... ccall( a, b, c ); // RDI, RSI, RDX dcall( a, b, c ); // RDX, RSI, RDI ``` The parameters are passed in the reverse order in functions with `extern(D)` linkage. Furthermore, on x86 the calling convention seems to be what is described by the current subsections, not only matching Windows x86, but also appears to be the same behaviour on System V ABI. Fixes #20204 . Signed-off-by: Luís Ferreira <[email protected]> https://github.com/dlang/dlang.org/pull/3120
Comment #3 by duser — 2022-02-17T03:21:54Z
*** Issue 20993 has been marked as a duplicate of this issue. ***
Comment #4 by robert.schadek — 2024-12-15T15:25:20Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/3979 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB