lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 2/15/2018 3:01 PM, Dibyendu Majumdar wrote:
On 15 February 2018 at 06:40, Thomas Buergel wrote:
Looks like there was a bug in luaffi when passing parameters to
functions on the stack on x86-64 platform. I have not found definitive
documentation clarifying this (if anyone can provide a reference that
would be very helpful) but it seems that stack arguments must be at 8
byte boundaries.

The two dominant x86-64 calling conventions in an overview:

For once, the one used on Windows is simpler:

Especially varargs can be a challenge on the SysV x86-64 ABI:

Thank you - I was aware of the first two references but there doesn't
seem to be a discussion on the requirements of size/alignment of
arguments passed on the stack.

I found following:


Above says:

The size of each argument gets rounded up to eightbytes

Don't forget Agner Fog (I guess he's more familiar to older folks), see the doc on calling conventions:

Kein-Hong Man (esq.)
Selangor, Malaysia