tinygo/src/runtime/os_darwin.c
Ayke van Laethem 7e9d84777e darwin: fix syscall.Open on darwin/arm64
Unfortunately the calling convention for variadic functions is different from
the calling convention of regular functions on darwin/arm64, and open happens
to be such a variadic function. The syscall package treated it like a regular
function, which resulted in buggy behavior.

This fix introduces a wrapper function. This is the cleanest change I could
come up with.
2022-10-13 21:07:38 +02:00

7 строки
283 Б
C

// Wrapper function because 'open' is a variadic function and variadic functions
// use a different (incompatible) calling convention on darwin/arm64.
#include <fcntl.h>
int syscall_libc_open(const char *pathname, int flags, mode_t mode) {
return open(pathname, flags, mode);
}