lua-users home
lua-l archive

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


On 15 February 2018 at 06:40, Thomas Buergel <Thomas.Buergel@varian.com> 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:
> https://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions
>
> For once, the one used on Windows is simpler:
> https://docs.microsoft.com/en-us/cpp/build/calling-convention
>
> Especially varargs can be a challenge on the SysV x86-64 ABI:
> https://blog.nelhage.com/2010/10/amd64-and-va_arg/
>


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:

https://stackoverflow.com/questions/32614007/size-and-alignment-of-x64-stack-arguments

And:

http://refspecs.linuxfoundation.org/elf/x86_64-abi-0.99.pdf

Above says:

The size of each argument gets rounded up to eightbytes

Regards
Dibyendu