[MLton] MLton broken FFI on AMD64???

Matthew Fluet matthew.fluet at gmail.com
Fri Feb 4 07:01:24 PST 2011


On Fri, Feb 4, 2011 at 3:57 AM, Wesley W. Terpstra <wesley at terpstra.ca> wrote:
> I then did some digging and found this choice quote in the "System V
> Application Binary Interface AMD64 Architecture Processor Supplement Draft
> Version 0.99.5":
> "    When a function taking variable-arguments is called, %rax must be set
> to the
> total number of floating point parameters passed to the function in vector
> registers"
>
> ... either we need to add another tag to imports like:
> _import "printf" stdarg : ... ;
> ... or we should just always set rax for every FFI call on AMD64?

Did you mean a "varargs" attribute?  That is, I would expect "stdargs"
(or "fixargs"?) to be the silent default.

Interestingly, it seems that MacOSX also demands that rax be set to
the the number of floating point parameters.

It seems that setting rax for every FFI call on AMD64 would be the
simplest solution.



More information about the MLton mailing list