Skip to content

optional parameter on M1 should be documented #29

@Ducasse

Description

@Ducasse

Yes, that is something kinda new, we should document it better

El 28 jun 2022, a las 16:20, Marcus Denker <marcus.denker@inria.fr> escribió:

So.. the problem was related to Variadic functions after all…
(I was already using the version with the latest fix for that)

fcntl is has a third optional parameter, and on X86, it seems there is was no problem to just do a call like that:

fcntl: fd command: cmd struct: struct

^ self 
	ffiCall: #(int fcntl(int fd, int cmd, FLock *struct))
	module: LibC

Which on the M1 lead to an ERRNO 14.

After exploring for far too long what could go wrong, I realised that it was missing the fixedArgumentCount: specification.

fcntl: fd command: cmd struct: struct
^ self
ffiCall: #(int fcntl(int fd, int cmd, FLock *struct))
library: LibC
fixedArgumentCount:2

The M1 changes how var args are passed, they are always passed via the stack, while on x86, it follows normal
functions of using the register if possible.

Marcus

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions